]>
Commit | Line | Data |
---|---|---|
0009d350 RJ |
1 | #ifndef MIDX_H |
2 | #define MIDX_H | |
a3407730 | 3 | |
c4d25228 DS |
4 | #include "repository.h" |
5 | ||
642e5703 RJ |
6 | struct object_id; |
7 | struct pack_entry; | |
64404a24 | 8 | struct repository; |
642e5703 | 9 | |
0465a505 DS |
10 | #define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX" |
11 | ||
4d80560c | 12 | struct multi_pack_index { |
c4d25228 DS |
13 | struct multi_pack_index *next; |
14 | ||
4d80560c DS |
15 | const unsigned char *data; |
16 | size_t data_len; | |
17 | ||
f894081d TB |
18 | const uint32_t *revindex_data; |
19 | const uint32_t *revindex_map; | |
20 | size_t revindex_len; | |
21 | ||
4d80560c DS |
22 | uint32_t signature; |
23 | unsigned char version; | |
24 | unsigned char hash_len; | |
25 | unsigned char num_chunks; | |
26 | uint32_t num_packs; | |
27 | uint32_t num_objects; | |
28 | ||
2cf489a3 DS |
29 | int local; |
30 | ||
32f3c541 | 31 | const unsigned char *chunk_pack_names; |
d7cacf29 | 32 | const uint32_t *chunk_oid_fanout; |
0d5b3a5e | 33 | const unsigned char *chunk_oid_lookup; |
662148c4 DS |
34 | const unsigned char *chunk_object_offsets; |
35 | const unsigned char *chunk_large_offsets; | |
32f3c541 | 36 | |
3227565c | 37 | const char **pack_names; |
3715a633 | 38 | struct packed_git **packs; |
4d80560c DS |
39 | char object_dir[FLEX_ARRAY]; |
40 | }; | |
41 | ||
efbc3aee WB |
42 | #define MIDX_PROGRESS (1 << 0) |
43 | ||
f894081d TB |
44 | char *get_midx_rev_filename(struct multi_pack_index *m); |
45 | ||
2cf489a3 | 46 | struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local); |
64404a24 | 47 | int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id); |
3715a633 | 48 | int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result); |
62f2c1b5 TB |
49 | off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos); |
50 | uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos); | |
8aac67a1 DS |
51 | struct object_id *nth_midxed_object_oid(struct object_id *oid, |
52 | struct multi_pack_index *m, | |
53 | uint32_t n); | |
64404a24 | 54 | int fill_midx_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m); |
013fd7ad | 55 | int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name); |
2cf489a3 | 56 | int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local); |
4d80560c | 57 | |
9218c6a4 | 58 | int write_midx_file(const char *object_dir, const char *preferred_pack_name, unsigned flags); |
1dcd9f20 | 59 | void clear_midx_file(struct repository *r); |
efbc3aee WB |
60 | int verify_midx_file(struct repository *r, const char *object_dir, unsigned flags); |
61 | int expire_midx_packs(struct repository *r, const char *object_dir, unsigned flags); | |
62 | int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, unsigned flags); | |
a3407730 | 63 | |
1dcd9f20 | 64 | void close_midx(struct multi_pack_index *m); |
a3407730 DS |
65 | |
66 | #endif |