diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-08-29 21:40:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-29 21:40:26 -0400 |
| commit | 147b659f3b1b54752e37c267862a5ade3eb9a902 (patch) | |
| tree | f546ae9261233ac113c8315d5b242165d0d38d20 /include/git2 | |
| parent | 18293385d00f4aba3c580022b183e0fe25caa741 (diff) | |
| parent | c3512fe6d2d499087874130740e6a28f0d9838f2 (diff) | |
| download | libgit2-147b659f3b1b54752e37c267862a5ade3eb9a902.tar.gz | |
Merge pull request #5405 from lhchavez/multi-pack-index-odb-write
midx: Introduce git_odb_write_multi_pack_index()
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/odb.h | 14 | ||||
| -rw-r--r-- | include/git2/sys/odb_backend.h | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h index 702e1bd30..dd484553f 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -391,6 +391,20 @@ GIT_EXTERN(int) git_odb_write_pack( void *progress_payload); /** + * Write a `multi-pack-index` file from all the `.pack` files in the ODB. + * + * If the ODB layer understands pack files, then this will create a file called + * `multi-pack-index` next to the `.pack` and `.idx` files, which will contain + * an index of all objects stored in `.pack` files. This will allow for + * O(log n) lookup for n objects (regardless of how many packfiles there + * exist). + * + * @param db object database where the `multi-pack-index` file will be written. + */ +GIT_EXTERN(int) git_odb_write_multi_pack_index( + git_odb *db); + +/** * Determine the object-ID (sha1 hash) of a data buffer * * The resulting SHA-1 OID will be the identifier for the data diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h index 4dba460af..9ae0ed9b3 100644 --- a/include/git2/sys/odb_backend.h +++ b/include/git2/sys/odb_backend.h @@ -85,6 +85,13 @@ struct git_odb_backend { git_indexer_progress_cb progress_cb, void *progress_payload); /** + * If the backend supports pack files, this will create a + * `multi-pack-index` file which will contain an index of all objects + * across all the `.pack` files. + */ + int GIT_CALLBACK(writemidx)(git_odb_backend *); + + /** * "Freshens" an already existing object, updating its last-used * time. This occurs when `git_odb_write` was called, but the * object already existed (and will not be re-written). The |
