midx: read objects from multi-pack-index
[git/git.git] / midx.h
CommitLineData
a3407730
DS
1#ifndef __MIDX_H__
2#define __MIDX_H__
3
c4d25228
DS
4#include "repository.h"
5
4d80560c 6struct multi_pack_index {
c4d25228
DS
7 struct multi_pack_index *next;
8
4d80560c
DS
9 int fd;
10
11 const unsigned char *data;
12 size_t data_len;
13
14 uint32_t signature;
15 unsigned char version;
16 unsigned char hash_len;
17 unsigned char num_chunks;
18 uint32_t num_packs;
19 uint32_t num_objects;
20
32f3c541 21 const unsigned char *chunk_pack_names;
d7cacf29 22 const uint32_t *chunk_oid_fanout;
0d5b3a5e 23 const unsigned char *chunk_oid_lookup;
662148c4
DS
24 const unsigned char *chunk_object_offsets;
25 const unsigned char *chunk_large_offsets;
32f3c541 26
3227565c 27 const char **pack_names;
3715a633 28 struct packed_git **packs;
4d80560c
DS
29 char object_dir[FLEX_ARRAY];
30};
31
32struct multi_pack_index *load_multi_pack_index(const char *object_dir);
3715a633
DS
33int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
34int fill_midx_entry(const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
c4d25228 35int prepare_multi_pack_index_one(struct repository *r, const char *object_dir);
4d80560c 36
a3407730
DS
37int write_midx_file(const char *object_dir);
38
39#endif