pack-bitmap.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef PACK_BITMAP_H
  2. #define PACK_BITMAP_H
  3. #include "ewah/ewok.h"
  4. #include "khash.h"
  5. #include "pack.h"
  6. #include "pack-objects.h"
  7. struct commit;
  8. struct repository;
  9. struct rev_info;
  10. struct list_objects_filter_options;
  11. static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
  12. struct bitmap_disk_header {
  13. char magic[ARRAY_SIZE(BITMAP_IDX_SIGNATURE)];
  14. uint16_t version;
  15. uint16_t options;
  16. uint32_t entry_count;
  17. unsigned char checksum[GIT_MAX_RAWSZ];
  18. };
  19. #define NEEDS_BITMAP (1u<<22)
  20. enum pack_bitmap_opts {
  21. BITMAP_OPT_FULL_DAG = 1,
  22. BITMAP_OPT_HASH_CACHE = 4,
  23. };
  24. enum pack_bitmap_flags {
  25. BITMAP_FLAG_REUSE = 0x1
  26. };
  27. typedef int (*show_reachable_fn)(
  28. const struct object_id *oid,
  29. enum object_type type,
  30. int flags,
  31. uint32_t hash,
  32. struct packed_git *found_pack,
  33. off_t found_offset);
  34. struct bitmap_index;
  35. struct bitmap_index *prepare_bitmap_git(struct repository *r);
  36. void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
  37. uint32_t *trees, uint32_t *blobs, uint32_t *tags);
  38. void traverse_bitmap_commit_list(struct bitmap_index *,
  39. struct rev_info *revs,
  40. show_reachable_fn show_reachable);
  41. void test_bitmap_walk(struct rev_info *revs);
  42. struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
  43. struct list_objects_filter_options *filter);
  44. int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
  45. struct packed_git **packfile,
  46. uint32_t *entries,
  47. struct bitmap **reuse_out);
  48. int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
  49. kh_oid_map_t *reused_bitmaps, int show_progress);
  50. void free_bitmap_index(struct bitmap_index *);
  51. int bitmap_walk_contains(struct bitmap_index *,
  52. struct bitmap *bitmap, const struct object_id *oid);
  53. /*
  54. * After a traversal has been performed by prepare_bitmap_walk(), this can be
  55. * queried to see if a particular object was reachable from any of the
  56. * objects flagged as UNINTERESTING.
  57. */
  58. int bitmap_has_oid_in_uninteresting(struct bitmap_index *, const struct object_id *oid);
  59. void bitmap_writer_show_progress(int show);
  60. void bitmap_writer_set_checksum(unsigned char *sha1);
  61. void bitmap_writer_build_type_index(struct packing_data *to_pack,
  62. struct pack_idx_entry **index,
  63. uint32_t index_nr);
  64. void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack);
  65. void bitmap_writer_select_commits(struct commit **indexed_commits,
  66. unsigned int indexed_commits_nr, int max_bitmaps);
  67. void bitmap_writer_build(struct packing_data *to_pack);
  68. void bitmap_writer_finish(struct pack_idx_entry **index,
  69. uint32_t index_nr,
  70. const char *filename,
  71. uint16_t options);
  72. #endif