From 73e602a5c2c766caba59948e91c11122653705ec Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 10 Mar 2026 13:30:48 +0800 Subject: commitgraph: Move out of format/ --- commitgraph/bloom/filter.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 commitgraph/bloom/filter.go (limited to 'commitgraph/bloom/filter.go') 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 +} -- cgit v1.3.1-10-gc9f91