bloom

package
v0.0.0-...-53d0996 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL