sbloom

package module
v0.0.0-...-405c65b Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2015 License: MIT Imports: 7 Imported by: 11

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 represents a scalable bloom filter.

func NewFilter

func NewFilter(h hash.Hash64, k int) *Filter

NewFilter returns a scalable bloom filter with a false positive probaility less than 1/2**k. It starts with a default size of 1024 bits per k. If you know you will use more/less than that, use NewSizedFilter for a better hint. It uses the provided hash to operate.

func NewSizedFilter

func NewSizedFilter(h hash.Hash64, k int, log uint) *Filter

NewSizedFilter returns a scalable bloom filter with a false positive probability less than 1/2**k. It start with a default size of 2**log bits per k. It uses the provided hash to operate.

func (*Filter) Add

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

Add adds the slice of bytes to the filter so that it will always return true when looked up.

func (*Filter) GobDecode

func (f *Filter) GobDecode(p []byte) (err error)

GobDecode sets the filters state to the gob marshalled value in the buffer.

func (*Filter) GobEncode

func (f *Filter) GobEncode() (p []byte, err error)

GobEncode returns the gob marshalled value of the filter.

func (*Filter) Lookup

func (f *Filter) Lookup(p []byte) bool

Lookup looks for the set of bytes in the bloom filter. If it returns false, the set of bytes has definitely not been seen before.

Jump to

Keyboard shortcuts

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