The seventh batch
[git/git.git] / midx.h
CommitLineData
0009d350
RJ
1#ifndef MIDX_H
2#define MIDX_H
a3407730 3
c4d25228
DS
4#include "repository.h"
5
642e5703
RJ
6struct object_id;
7struct pack_entry;
8
0465a505
DS
9#define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
10
4d80560c 11struct multi_pack_index {
c4d25228
DS
12 struct multi_pack_index *next;
13
4d80560c
DS
14 int fd;
15
16 const unsigned char *data;
17 size_t data_len;
18
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;
25
2cf489a3
DS
26 int local;
27
32f3c541 28 const unsigned char *chunk_pack_names;
d7cacf29 29 const uint32_t *chunk_oid_fanout;
0d5b3a5e 30 const unsigned char *chunk_oid_lookup;
662148c4
DS
31 const unsigned char *chunk_object_offsets;
32 const unsigned char *chunk_large_offsets;
32f3c541 33
3227565c 34 const char **pack_names;
3715a633 35 struct packed_git **packs;
4d80560c
DS
36 char object_dir[FLEX_ARRAY];
37};
38
2cf489a3 39struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
0bff5269 40int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id);
3715a633 41int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
8aac67a1
DS
42struct object_id *nth_midxed_object_oid(struct object_id *oid,
43 struct multi_pack_index *m,
44 uint32_t n);
3715a633 45int fill_midx_entry(const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
013fd7ad 46int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name);
2cf489a3 47int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
4d80560c 48
a3407730 49int write_midx_file(const char *object_dir);
1dcd9f20 50void clear_midx_file(struct repository *r);
56ee7ff1 51int verify_midx_file(const char *object_dir);
a3407730 52
1dcd9f20 53void close_midx(struct multi_pack_index *m);
a3407730
DS
54
55#endif