Documentation ¶
Overview ¶
Package oppobloom implements a filter data structure that may report false negatives but no false positives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSizeTooLarge = errors.New("oppobloom: size given too large to round to a power of 2")
View Source
var ErrSizeTooSmall = errors.New("oppobloom: filter cannot have a zero or negative size")
View Source
var MaxFilterSize = 1 << 30
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func (*Filter) ContainsAndAdd ¶
ContainsAndAdd adds the id to the filter and returns true if the id was already present in it. False positives are not possible but false negatives are (that is, this function will never incorrectly return true but may incorrectly return false). False negatives occur when the given id has been previously seen, but in the time since that id was last passed to this method, a different id that hashed to the same index in the filter was added.
ContainsAndAdd is thread-safe.
Click to show internal directories.
Click to hide internal directories.