Documentation
¶
Overview ¶
Package bloom provides a bloom filter implementation used for changed-path filters in Git commit graphs.
Index ¶
Constants ¶
const ( // DataHeaderSize is the size of the BDAT header in commit-graph files. DataHeaderSize = 3 * 4 // DefaultMaxChange matches Git's default max-changed-paths behavior. DefaultMaxChange = 512 )
Variables ¶
var ErrInvalid = errors.New("bloom: invalid data")
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
Data []byte
HashVersion uint32
NumHashes uint32
BitsPerEntry uint32
MaxChangePaths uint32
}
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").
func (*Filter) MightContain ¶
MightContain reports whether the Bloom filter may contain the given path.
Evaluated against the full path and each of its directory prefixes. A true result indicates a possible match; false means the path definitely did not change.
type Settings ¶
type Settings struct {
HashVersion uint32
NumHashes uint32
BitsPerEntry uint32
MaxChangePaths uint32
}
Settings describe the changed-paths Bloom filter parameters stored in commit-graph BDAT chunks.
Obviously, they must match the repository's commit-graph settings to interpret filters correctly.
func ParseSettings ¶
ParseSettings reads Bloom filter settings from a BDAT chunk header.