Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyDump = errors.New("empty dump")
Functions ¶
This section is empty.
Types ¶
type CountingFilter ¶
type CountingFilter struct {
// contains filtered or unexported fields
}
func NewCounting ¶
func NewCounting(n int, p float64) *CountingFilter
NewCounting creates an optimized counting bloom filter.
func NewCountingFromBytes ¶
func NewCountingFromBytes(data []byte) (*CountingFilter, error)
NewCountingFromBytes deserializes a byte slice into a CountingFilter.
func (*CountingFilter) Add ¶
func (f *CountingFilter) Add(data []byte)
Add inserts data into the filter by incrementing its counters. It protects against counter overflow (stopping at 255).
func (*CountingFilter) Remove ¶
func (f *CountingFilter) Remove(data []byte)
Remove deletes data from the filter by decrementing its counters. It protects against counter underflow (stopping at 0).
func (*CountingFilter) Reset ¶
func (f *CountingFilter) Reset()
Reset clears all counters in the filter.
func (*CountingFilter) Test ¶
func (f *CountingFilter) Test(data []byte) bool
Test checks if an item is likely in the set. It returns true if the item might be in the filter, false if it is definitely not.
func (*CountingFilter) ToBytes ¶
func (f *CountingFilter) ToBytes() ([]byte, error)
ToBytes serializes the CountingFilter to a byte slice.
Click to show internal directories.
Click to hide internal directories.