4 #include "string-list.h"
11 #define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
12 #define GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP \
13 "GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP"
15 struct multi_pack_index
{
16 struct multi_pack_index
*next
;
18 const unsigned char *data
;
21 const uint32_t *revindex_data
;
22 const uint32_t *revindex_map
;
26 unsigned char version
;
27 unsigned char hash_len
;
28 unsigned char num_chunks
;
31 int preferred_pack_idx
;
35 const unsigned char *chunk_pack_names
;
36 size_t chunk_pack_names_len
;
37 const uint32_t *chunk_bitmapped_packs
;
38 size_t chunk_bitmapped_packs_len
;
39 const uint32_t *chunk_oid_fanout
;
40 const unsigned char *chunk_oid_lookup
;
41 const unsigned char *chunk_object_offsets
;
42 const unsigned char *chunk_large_offsets
;
43 size_t chunk_large_offsets_len
;
44 const unsigned char *chunk_revindex
;
45 size_t chunk_revindex_len
;
47 const char **pack_names
;
48 struct packed_git
**packs
;
49 char object_dir
[FLEX_ARRAY
];
52 #define MIDX_PROGRESS (1 << 0)
53 #define MIDX_WRITE_REV_INDEX (1 << 1)
54 #define MIDX_WRITE_BITMAP (1 << 2)
55 #define MIDX_WRITE_BITMAP_HASH_CACHE (1 << 3)
56 #define MIDX_WRITE_BITMAP_LOOKUP_TABLE (1 << 4)
58 const unsigned char *get_midx_checksum(struct multi_pack_index
*m
);
59 void get_midx_filename(struct strbuf
*out
, const char *object_dir
);
60 void get_midx_rev_filename(struct strbuf
*out
, struct multi_pack_index
*m
);
62 struct multi_pack_index
*load_multi_pack_index(const char *object_dir
, int local
);
63 int prepare_midx_pack(struct repository
*r
, struct multi_pack_index
*m
, uint32_t pack_int_id
);
64 int nth_bitmapped_pack(struct repository
*r
, struct multi_pack_index
*m
,
65 struct bitmapped_pack
*bp
, uint32_t pack_int_id
);
66 int bsearch_midx(const struct object_id
*oid
, struct multi_pack_index
*m
, uint32_t *result
);
67 off_t
nth_midxed_offset(struct multi_pack_index
*m
, uint32_t pos
);
68 uint32_t nth_midxed_pack_int_id(struct multi_pack_index
*m
, uint32_t pos
);
69 struct object_id
*nth_midxed_object_oid(struct object_id
*oid
,
70 struct multi_pack_index
*m
,
72 int fill_midx_entry(struct repository
*r
, const struct object_id
*oid
, struct pack_entry
*e
, struct multi_pack_index
*m
);
73 int midx_contains_pack(struct multi_pack_index
*m
,
74 const char *idx_or_pack_name
);
75 int midx_locate_pack(struct multi_pack_index
*m
, const char *idx_or_pack_name
,
77 int midx_preferred_pack(struct multi_pack_index
*m
, uint32_t *pack_int_id
);
78 int prepare_multi_pack_index_one(struct repository
*r
, const char *object_dir
, int local
);
81 * Variant of write_midx_file which writes a MIDX containing only the packs
82 * specified in packs_to_include.
84 int write_midx_file(const char *object_dir
,
85 const char *preferred_pack_name
,
86 const char *refs_snapshot
,
88 int write_midx_file_only(const char *object_dir
,
89 struct string_list
*packs_to_include
,
90 const char *preferred_pack_name
,
91 const char *refs_snapshot
,
93 void clear_midx_file(struct repository
*r
);
94 int verify_midx_file(struct repository
*r
, const char *object_dir
, unsigned flags
);
95 int expire_midx_packs(struct repository
*r
, const char *object_dir
, unsigned flags
);
96 int midx_repack(struct repository
*r
, const char *object_dir
, size_t batch_size
, unsigned flags
);
98 void close_midx(struct multi_pack_index
*m
);