Merge branch 'jh/json-writer'
[alt-git.git] / pack-bitmap.h
blob4555907dee99fbf731b739c584837adbbe8270f1
1 #ifndef PACK_BITMAP_H
2 #define PACK_BITMAP_H
4 #include "ewah/ewok.h"
5 #include "khash.h"
6 #include "pack-objects.h"
8 struct bitmap_disk_header {
9 char magic[4];
10 uint16_t version;
11 uint16_t options;
12 uint32_t entry_count;
13 unsigned char checksum[20];
16 static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
18 #define NEEDS_BITMAP (1u<<22)
20 enum pack_bitmap_opts {
21 BITMAP_OPT_FULL_DAG = 1,
22 BITMAP_OPT_HASH_CACHE = 4,
25 enum pack_bitmap_flags {
26 BITMAP_FLAG_REUSE = 0x1
29 typedef int (*show_reachable_fn)(
30 const struct object_id *oid,
31 enum object_type type,
32 int flags,
33 uint32_t hash,
34 struct packed_git *found_pack,
35 off_t found_offset);
37 struct bitmap_index;
39 struct bitmap_index *prepare_bitmap_git(void);
40 void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
41 uint32_t *trees, uint32_t *blobs, uint32_t *tags);
42 void traverse_bitmap_commit_list(struct bitmap_index *,
43 show_reachable_fn show_reachable);
44 void test_bitmap_walk(struct rev_info *revs);
45 struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs);
46 int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
47 struct packed_git **packfile,
48 uint32_t *entries, off_t *up_to);
49 int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
50 khash_sha1 *reused_bitmaps, int show_progress);
51 void free_bitmap_index(struct bitmap_index *);
53 void bitmap_writer_show_progress(int show);
54 void bitmap_writer_set_checksum(unsigned char *sha1);
55 void bitmap_writer_build_type_index(struct packing_data *to_pack,
56 struct pack_idx_entry **index,
57 uint32_t index_nr);
58 void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack);
59 void bitmap_writer_select_commits(struct commit **indexed_commits,
60 unsigned int indexed_commits_nr, int max_bitmaps);
61 void bitmap_writer_build(struct packing_data *to_pack);
62 void bitmap_writer_finish(struct pack_idx_entry **index,
63 uint32_t index_nr,
64 const char *filename,
65 uint16_t options);
67 #endif