2018-10-18 00:13:26 +02:00
|
|
|
#ifndef MIDX_H
|
|
|
|
#define MIDX_H
|
2018-07-12 21:39:21 +02:00
|
|
|
|
2018-07-12 21:39:33 +02:00
|
|
|
#include "repository.h"
|
|
|
|
|
2018-09-19 02:13:36 +02:00
|
|
|
struct object_id;
|
|
|
|
struct pack_entry;
|
|
|
|
|
2018-07-12 21:39:23 +02:00
|
|
|
struct multi_pack_index {
|
2018-07-12 21:39:33 +02:00
|
|
|
struct multi_pack_index *next;
|
|
|
|
|
2018-07-12 21:39:23 +02:00
|
|
|
int fd;
|
|
|
|
|
|
|
|
const unsigned char *data;
|
|
|
|
size_t data_len;
|
|
|
|
|
|
|
|
uint32_t signature;
|
|
|
|
unsigned char version;
|
|
|
|
unsigned char hash_len;
|
|
|
|
unsigned char num_chunks;
|
|
|
|
uint32_t num_packs;
|
|
|
|
uint32_t num_objects;
|
|
|
|
|
2018-08-20 18:51:55 +02:00
|
|
|
int local;
|
|
|
|
|
2018-07-12 21:39:27 +02:00
|
|
|
const unsigned char *chunk_pack_names;
|
2018-07-12 21:39:31 +02:00
|
|
|
const uint32_t *chunk_oid_fanout;
|
2018-07-12 21:39:30 +02:00
|
|
|
const unsigned char *chunk_oid_lookup;
|
2018-07-12 21:39:32 +02:00
|
|
|
const unsigned char *chunk_object_offsets;
|
|
|
|
const unsigned char *chunk_large_offsets;
|
2018-07-12 21:39:27 +02:00
|
|
|
|
2018-07-12 21:39:28 +02:00
|
|
|
const char **pack_names;
|
2018-07-12 21:39:34 +02:00
|
|
|
struct packed_git **packs;
|
2018-07-12 21:39:23 +02:00
|
|
|
char object_dir[FLEX_ARRAY];
|
|
|
|
};
|
|
|
|
|
2018-08-20 18:51:55 +02:00
|
|
|
struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
|
2018-08-20 18:52:02 +02:00
|
|
|
int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id);
|
2018-07-12 21:39:34 +02:00
|
|
|
int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
|
2018-07-12 21:39:35 +02:00
|
|
|
struct object_id *nth_midxed_object_oid(struct object_id *oid,
|
|
|
|
struct multi_pack_index *m,
|
|
|
|
uint32_t n);
|
2018-07-12 21:39:34 +02:00
|
|
|
int fill_midx_entry(const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
|
2018-07-12 21:39:36 +02:00
|
|
|
int midx_contains_pack(struct multi_pack_index *m, const char *idx_name);
|
2018-08-20 18:51:55 +02:00
|
|
|
int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
|
2018-07-12 21:39:23 +02:00
|
|
|
|
2018-07-12 21:39:21 +02:00
|
|
|
int write_midx_file(const char *object_dir);
|
2018-07-12 21:39:40 +02:00
|
|
|
void clear_midx_file(const char *object_dir);
|
2018-09-13 20:02:13 +02:00
|
|
|
int verify_midx_file(const char *object_dir);
|
2018-07-12 21:39:21 +02:00
|
|
|
|
|
|
|
#endif
|