Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 1 | #ifndef PACK_BITMAP_H |
| 2 | #define PACK_BITMAP_H |
| 3 | |
| 4 | #include "ewah/ewok.h" |
| 5 | #include "khash.h" |
Vicent Marti | 7cc8f97 | 2013-12-21 09:00:16 -0500 | [diff] [blame] | 6 | #include "pack-objects.h" |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 7 | |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 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]; |
| 14 | }; |
| 15 | |
| 16 | static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'}; |
| 17 | |
Vicent Marti | 7cc8f97 | 2013-12-21 09:00:16 -0500 | [diff] [blame] | 18 | #define NEEDS_BITMAP (1u<<22) |
| 19 | |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 20 | enum pack_bitmap_opts { |
Vicent Marti | ae4f07f | 2013-12-21 09:00:45 -0500 | [diff] [blame] | 21 | BITMAP_OPT_FULL_DAG = 1, |
| 22 | BITMAP_OPT_HASH_CACHE = 4, |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 23 | }; |
| 24 | |
Vicent Marti | 7cc8f97 | 2013-12-21 09:00:16 -0500 | [diff] [blame] | 25 | enum pack_bitmap_flags { |
| 26 | BITMAP_FLAG_REUSE = 0x1 |
| 27 | }; |
| 28 | |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 29 | typedef int (*show_reachable_fn)( |
| 30 | const unsigned char *sha1, |
| 31 | enum object_type type, |
| 32 | int flags, |
| 33 | uint32_t hash, |
| 34 | struct packed_git *found_pack, |
| 35 | off_t found_offset); |
| 36 | |
| 37 | int prepare_bitmap_git(void); |
| 38 | void count_bitmap_commit_list(uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags); |
| 39 | void traverse_bitmap_commit_list(show_reachable_fn show_reachable); |
| 40 | void test_bitmap_walk(struct rev_info *revs); |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 41 | int prepare_bitmap_walk(struct rev_info *revs); |
| 42 | int reuse_partial_packfile_from_bitmap(struct packed_git **packfile, uint32_t *entries, off_t *up_to); |
Vicent Marti | 7cc8f97 | 2013-12-21 09:00:16 -0500 | [diff] [blame] | 43 | int rebuild_existing_bitmaps(struct packing_data *mapping, khash_sha1 *reused_bitmaps, int show_progress); |
| 44 | |
| 45 | void bitmap_writer_show_progress(int show); |
| 46 | void bitmap_writer_set_checksum(unsigned char *sha1); |
| 47 | void bitmap_writer_build_type_index(struct pack_idx_entry **index, uint32_t index_nr); |
| 48 | void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack); |
| 49 | void bitmap_writer_select_commits(struct commit **indexed_commits, |
| 50 | unsigned int indexed_commits_nr, int max_bitmaps); |
| 51 | void bitmap_writer_build(struct packing_data *to_pack); |
| 52 | void bitmap_writer_finish(struct pack_idx_entry **index, |
| 53 | uint32_t index_nr, |
Vicent Marti | ae4f07f | 2013-12-21 09:00:45 -0500 | [diff] [blame] | 54 | const char *filename, |
| 55 | uint16_t options); |
Vicent Marti | fff4275 | 2013-12-21 09:00:01 -0500 | [diff] [blame] | 56 | |
| 57 | #endif |