]> git.ipfire.org Git - thirdparty/git.git/blobdiff - bloom.h
Merge branch 'en/merge-ort-api-null-impl'
[thirdparty/git.git] / bloom.h
diff --git a/bloom.h b/bloom.h
index d8fbb0fbf19631ccb33d2e57590f977467579102..adde6dfe21254f7022051fd6d3c19b722b34f54e 100644 (file)
--- a/bloom.h
+++ b/bloom.h
@@ -28,9 +28,18 @@ struct bloom_filter_settings {
         * that contain n*b bits.
         */
        uint32_t bits_per_entry;
+
+       /*
+        * The maximum number of changed paths per commit
+        * before declaring a Bloom filter to be too-large.
+        *
+        * Not written to the commit-graph file.
+        */
+       uint32_t max_changed_paths;
 };
 
-#define DEFAULT_BLOOM_FILTER_SETTINGS { 1, 7, 10 }
+#define DEFAULT_BLOOM_MAX_CHANGES 512
+#define DEFAULT_BLOOM_FILTER_SETTINGS { 1, 7, 10, DEFAULT_BLOOM_MAX_CHANGES }
 #define BITS_PER_WORD 8
 #define BLOOMDATA_CHUNK_HEADER_SIZE 3 * sizeof(uint32_t)
 
@@ -80,9 +89,21 @@ void add_key_to_filter(const struct bloom_key *key,
 
 void init_bloom_filters(void);
 
-struct bloom_filter *get_bloom_filter(struct repository *r,
-                                     struct commit *c,
-                                     int compute_if_not_present);
+enum bloom_filter_computed {
+       BLOOM_NOT_COMPUTED = (1 << 0),
+       BLOOM_COMPUTED     = (1 << 1),
+       BLOOM_TRUNC_LARGE  = (1 << 2),
+       BLOOM_TRUNC_EMPTY  = (1 << 3),
+};
+
+struct bloom_filter *get_or_compute_bloom_filter(struct repository *r,
+                                                struct commit *c,
+                                                int compute_if_not_present,
+                                                const struct bloom_filter_settings *settings,
+                                                enum bloom_filter_computed *computed);
+
+#define get_bloom_filter(r, c) get_or_compute_bloom_filter( \
+       (r), (c), 0, NULL, NULL)
 
 int bloom_filter_contains(const struct bloom_filter *filter,
                          const struct bloom_key *key,