Merge branch 'ma/clear-repository-format'
[git/raj.git] / midx.h
blob774f652530c42983368149bd9fe42f3ed063ab5d
1 #ifndef MIDX_H
2 #define MIDX_H
4 #include "repository.h"
6 struct object_id;
7 struct pack_entry;
9 #define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
11 struct multi_pack_index {
12 struct multi_pack_index *next;
14 int fd;
16 const unsigned char *data;
17 size_t data_len;
19 uint32_t signature;
20 unsigned char version;
21 unsigned char hash_len;
22 unsigned char num_chunks;
23 uint32_t num_packs;
24 uint32_t num_objects;
26 int local;
28 const unsigned char *chunk_pack_names;
29 const uint32_t *chunk_oid_fanout;
30 const unsigned char *chunk_oid_lookup;
31 const unsigned char *chunk_object_offsets;
32 const unsigned char *chunk_large_offsets;
34 const char **pack_names;
35 struct packed_git **packs;
36 char object_dir[FLEX_ARRAY];
39 struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
40 int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id);
41 int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
42 struct object_id *nth_midxed_object_oid(struct object_id *oid,
43 struct multi_pack_index *m,
44 uint32_t n);
45 int fill_midx_entry(const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
46 int midx_contains_pack(struct multi_pack_index *m, const char *idx_name);
47 int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
49 int write_midx_file(const char *object_dir);
50 void clear_midx_file(struct repository *r);
51 int verify_midx_file(const char *object_dir);
53 void close_midx(struct multi_pack_index *m);
55 #endif