7 struct bloom_filter_settings {
9 * The version of the hashing technique being used.
10 * We currently only support version = 1 which is
11 * the seeded murmur3 hashing technique implemented
14 uint32_t hash_version;
17 * The number of times a path is hashed, i.e. the
18 * number of bit positions tht cumulatively
19 * determine whether a path is present in the
25 * The minimum number of bits per entry in the Bloom
26 * filter. If the filter contains 'n' entries, then
27 * filter size is the minimum number of 8-bit words
28 * that contain n*b bits.
30 uint32_t bits_per_entry;
33 #define DEFAULT_BLOOM_FILTER_SETTINGS { 1, 7, 10 }
34 #define BITS_PER_WORD 8
37 * A bloom_filter struct represents a data segment to
38 * use when testing hash values. The 'len' member
39 * dictates how many entries are stored in
48 * A bloom_key represents the k hash values for a
49 * given string. These can be precomputed and
50 * stored in a bloom_key for re-use when testing
51 * against a bloom_filter. The number of hashes is
52 * given by the Bloom filter settings and is the same
53 * for all Bloom filters and keys interacting with
54 * the loaded version of the commit graph file and
55 * the Bloom data chunks.
62 * Calculate the murmur3 32-bit hash value for the given data
63 * using the given seed.
64 * Produces a uniformly distributed hash value.
65 * Not considered to be cryptographically secure.
66 * Implemented as described in https://en.wikipedia.org/wiki/MurmurHash#Algorithm
68 uint32_t murmur3_seeded(uint32_t seed, const char *data, size_t len);
70 void fill_bloom_key(const char *data,
72 struct bloom_key *key,
73 const struct bloom_filter_settings *settings);
75 void add_key_to_filter(const struct bloom_key *key,
76 struct bloom_filter *filter,
77 const struct bloom_filter_settings *settings);
79 void init_bloom_filters(void);
81 struct bloom_filter *get_bloom_filter(struct repository *r,