1#ifndef MIDX_H
2#define MIDX_H
34
#include "repository.h"
56
struct object_id;
7struct pack_entry;
8struct repository;
910
#define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
1112
struct multi_pack_index {
13struct multi_pack_index *next;
1415
int fd;
1617
const unsigned char *data;
18size_t data_len;
1920
uint32_t signature;
21unsigned char version;
22unsigned char hash_len;
23unsigned char num_chunks;
24uint32_t num_packs;
25uint32_t num_objects;
2627
int local;
2829
const unsigned char *chunk_pack_names;
30const uint32_t *chunk_oid_fanout;
31const unsigned char *chunk_oid_lookup;
32const unsigned char *chunk_object_offsets;
33const unsigned char *chunk_large_offsets;
3435
const char **pack_names;
36struct packed_git **packs;
37char object_dir[FLEX_ARRAY];
38};
3940
struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
41int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id);
42int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
43struct object_id *nth_midxed_object_oid(struct object_id *oid,
44struct multi_pack_index *m,
45uint32_t n);
46int fill_midx_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
47int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name);
48int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
4950
int write_midx_file(const char *object_dir);
51void clear_midx_file(struct repository *r);
52int verify_midx_file(struct repository *r, const char *object_dir);
5354
void close_midx(struct multi_pack_index *m);
5556
#endif