path: root/midx.h
diff options
authorJunio C Hamano <>2018-08-20 22:29:54 (GMT)
committerJunio C Hamano <>2018-08-20 22:29:54 (GMT)
commitc00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8 (patch)
tree0c9e688081200f8984a6ac8850483c63c0ca8649 /midx.h
parent7e8bfb0412581daf8f3c89909f1d37844e8610dd (diff)
parent525e18c04bb38450e6677bb2aa5c65b78254b5c2 (diff)
Sync 'ds/multi-pack-index' to v2.19.0-rc0
* ds/multi-pack-index: (23 commits) midx: clear midx on repack packfile: skip loading index if in multi-pack-index midx: prevent duplicate packfile loads midx: use midx in approximate_object_count midx: use existing midx when writing new one midx: use midx in abbreviation calculations midx: read objects from multi-pack-index config: create core.multiPackIndex setting midx: write object offsets midx: write object id fanout chunk midx: write object ids in a chunk midx: sort and deduplicate objects from packfiles midx: read pack names into array multi-pack-index: write pack names in chunk multi-pack-index: read packfile list packfile: generalize pack directory list t5319: expand test data multi-pack-index: load into memory midx: write header information to lockfile multi-pack-index: add 'write' verb ...
Diffstat (limited to 'midx.h')
1 files changed, 44 insertions, 0 deletions
diff --git a/midx.h b/midx.h
new file mode 100644
index 0000000..e3b07f1
--- /dev/null
+++ b/midx.h
@@ -0,0 +1,44 @@
+#ifndef __MIDX_H__
+#define __MIDX_H__
+#include "repository.h"
+struct multi_pack_index {
+ struct multi_pack_index *next;
+ int fd;
+ const unsigned char *data;
+ size_t data_len;
+ uint32_t signature;
+ unsigned char version;
+ unsigned char hash_len;
+ unsigned char num_chunks;
+ uint32_t num_packs;
+ uint32_t num_objects;
+ const unsigned char *chunk_pack_names;
+ const uint32_t *chunk_oid_fanout;
+ const unsigned char *chunk_oid_lookup;
+ const unsigned char *chunk_object_offsets;
+ const unsigned char *chunk_large_offsets;
+ const char **pack_names;
+ struct packed_git **packs;
+ char object_dir[FLEX_ARRAY];
+struct multi_pack_index *load_multi_pack_index(const char *object_dir);
+int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
+struct object_id *nth_midxed_object_oid(struct object_id *oid,
+ struct multi_pack_index *m,
+ uint32_t n);
+int fill_midx_entry(const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
+int midx_contains_pack(struct multi_pack_index *m, const char *idx_name);
+int prepare_multi_pack_index_one(struct repository *r, const char *object_dir);
+int write_midx_file(const char *object_dir);
+void clear_midx_file(const char *object_dir);