2 * Copyright (C) the libgit2 contributors. All rights reserved.
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
8 #ifndef INCLUDE_midx_h__
9 #define INCLUDE_midx_h__
19 * A multi-pack-index file.
21 * This file contains a merged index for multiple independent .pack files. This
22 * can help speed up locating objects without requiring a garbage collection
23 * cycle to create a single .pack file.
25 * Support for this feature was added in git 2.21, and requires the
26 * `core.multiPackIndex` config option to be set.
28 typedef struct git_midx_file
{
31 /* The table of Packfile Names. */
32 git_vector packfile_names
;
34 /* The OID Fanout table. */
35 const uint32_t *oid_fanout
;
36 /* The total number of objects in the index. */
39 /* The OID Lookup table. */
42 /* The Object Offsets table. Each entry has two 4-byte fields with the pack index and the offset. */
43 const unsigned char *object_offsets
;
45 /* The Object Large Offsets table. */
46 const unsigned char *object_large_offsets
;
47 /* The number of entries in the Object Large Offsets table. Each entry has an 8-byte with an offset */
48 size_t num_object_large_offsets
;
50 /* The trailer of the file. Contains the SHA1-checksum of the whole file. */
55 * An entry in the multi-pack-index file. Similar in purpose to git_pack_entry.
57 typedef struct git_midx_entry
{
58 /* The index within idx->packfile_names where the packfile name can be found. */
60 /* The offset within the .pack file where the requested object is found. */
62 /* The SHA-1 hash of the requested object. */
67 git_midx_file
**idx_out
,
69 int git_midx_entry_find(
72 const git_oid
*short_oid
,
74 void git_midx_close(git_midx_file
*idx
);
75 void git_midx_free(git_midx_file
*idx
);
77 /* This is exposed for use in the fuzzers. */
80 const unsigned char *data
,