diff options
| author | 2026-03-10 13:30:48 +0800 | |
|---|---|---|
| committer | 2026-03-10 13:30:48 +0800 | |
| commit | 73e602a5c2c766caba59948e91c11122653705ec (patch) | |
| tree | 57951a4275dd90c2b3953e5b4bf3c9a7bd09b84a /commitgraph/bloom/filter.go | |
| parent | *: Move sideband64k and pktline to protocol/ (diff) | |
| signature | No signature | |
commitgraph: Move out of format/
Diffstat (limited to 'commitgraph/bloom/filter.go')
| -rw-r--r-- | commitgraph/bloom/filter.go | 28 |
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 +} |
