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