bloom

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter is an implementation of a bloom filter.

func New

func New(capacity, hashes int) *Filter

New creates a new Filter.

func NewWithBitSet

func NewWithBitSet(hashes int, bits *bitset.BitSet) *Filter

NewWithBitSet creates a new Filter with an existing BitSet.

func (*Filter) Add

func (f *Filter) Add(bytes []byte)

Add adds a value to the bloom filter.

func (*Filter) AddString

func (f *Filter) AddString(str string)

AddString adds a string to the bloom filter.

func (*Filter) Clear

func (f *Filter) Clear()

Clear clears the bloom filter, resetting every bit in the internal bit set.

func (*Filter) Test

func (f *Filter) Test(bytes []byte) bool

Test tests whether a value is present in the bloom filter.

When the result is false, the value is not present in the bloom filter. When the result is true, the value may have been added to the bloom filter, but it is not guaranteed to be present.

func (*Filter) TestAdd

func (f *Filter) TestAdd(bytes []byte) bool

TestAdd tests whether a value is in the bloom filter, and adds it in the process.

Equivalent to a call to Test and then Add, but more efficient than calling both.

func (*Filter) TestAddString

func (f *Filter) TestAddString(str string) bool

TestAddString tests whether a string is in the bloom filter, and adds it in the process.

Equivalent to a call to Test and then Add, but more efficient than calling both.

func (*Filter) TestString

func (f *Filter) TestString(str string) bool

TestString tests whether a string is present in the bloom filter.

When the result is false, the value is not present in the bloom filter. When the result is true, the value may have been added to the bloom filter, but it is not guaranteed to be present.

Jump to

Keyboard shortcuts

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