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