4 #include "repository.h"
10 #define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
12 struct multi_pack_index
{
13 struct multi_pack_index
*next
;
15 const unsigned char *data
;
18 const uint32_t *revindex_data
;
19 const uint32_t *revindex_map
;
23 unsigned char version
;
24 unsigned char hash_len
;
25 unsigned char num_chunks
;
31 const unsigned char *chunk_pack_names
;
32 const uint32_t *chunk_oid_fanout
;
33 const unsigned char *chunk_oid_lookup
;
34 const unsigned char *chunk_object_offsets
;
35 const unsigned char *chunk_large_offsets
;
37 const char **pack_names
;
38 struct packed_git
**packs
;
39 char object_dir
[FLEX_ARRAY
];
42 #define MIDX_PROGRESS (1 << 0)
43 #define MIDX_WRITE_REV_INDEX (1 << 1)
45 const unsigned char *get_midx_checksum(struct multi_pack_index
*m
);
46 char *get_midx_filename(const char *object_dir
);
47 char *get_midx_rev_filename(struct multi_pack_index
*m
);
49 struct multi_pack_index
*load_multi_pack_index(const char *object_dir
, int local
);
50 int prepare_midx_pack(struct repository
*r
, struct multi_pack_index
*m
, uint32_t pack_int_id
);
51 int bsearch_midx(const struct object_id
*oid
, struct multi_pack_index
*m
, uint32_t *result
);
52 off_t
nth_midxed_offset(struct multi_pack_index
*m
, uint32_t pos
);
53 uint32_t nth_midxed_pack_int_id(struct multi_pack_index
*m
, uint32_t pos
);
54 struct object_id
*nth_midxed_object_oid(struct object_id
*oid
,
55 struct multi_pack_index
*m
,
57 int fill_midx_entry(struct repository
*r
, const struct object_id
*oid
, struct pack_entry
*e
, struct multi_pack_index
*m
);
58 int midx_contains_pack(struct multi_pack_index
*m
, const char *idx_or_pack_name
);
59 int prepare_multi_pack_index_one(struct repository
*r
, const char *object_dir
, int local
);
61 int write_midx_file(const char *object_dir
, const char *preferred_pack_name
, unsigned flags
);
62 void clear_midx_file(struct repository
*r
);
63 int verify_midx_file(struct repository
*r
, const char *object_dir
, unsigned flags
);
64 int expire_midx_packs(struct repository
*r
, const char *object_dir
, unsigned flags
);
65 int midx_repack(struct repository
*r
, const char *object_dir
, size_t batch_size
, unsigned flags
);
67 void close_midx(struct multi_pack_index
*m
);