aboutsummaryrefslogtreecommitdiff
path: root/commitgraph/bloom/filter.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-10 13:30:48 +0800
committerGravatar Runxi Yu2026-03-10 13:30:48 +0800
commit73e602a5c2c766caba59948e91c11122653705ec (patch)
tree57951a4275dd90c2b3953e5b4bf3c9a7bd09b84a /commitgraph/bloom/filter.go
parent*: Move sideband64k and pktline to protocol/ (diff)
signatureNo signature
commitgraph: Move out of format/
Diffstat (limited to 'commitgraph/bloom/filter.go')
-rw-r--r--commitgraph/bloom/filter.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/commitgraph/bloom/filter.go b/commitgraph/bloom/filter.go
new file mode 100644
index 00000000..7c4aa1b8
--- /dev/null
+++ b/commitgraph/bloom/filter.go
@@ -0,0 +1,28 @@
+package bloom
+
+// Filter represents a changed-paths Bloom filter associated with a commit.
+//
+// The filter encodes which paths changed between a commit and its first
+// parent. Paths are expected to be in Git's slash-separated form and
+// are queried using a path and its prefixes (e.g. "a/b/c", "a/b", "a").
+type Filter struct {
+ Data []byte
+
+ HashVersion uint32
+ NumHashes uint32
+ BitsPerEntry uint32
+ MaxChangePaths uint32
+}
+
+// NewFilter constructs one query-ready bloom filter from raw data/settings.
+func NewFilter(data []byte, settings Settings) *Filter {
+ out := &Filter{
+ Data: data,
+ HashVersion: settings.HashVersion,
+ NumHashes: settings.NumHashes,
+ BitsPerEntry: settings.BitsPerEntry,
+ MaxChangePaths: settings.MaxChangePaths,
+ }
+
+ return out
+}