bloomfilter

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: AGPL-3.0 Imports: 6 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 a bloom filter implementation

func NewFromBytes

func NewFromBytes(data []byte) (*Filter, error)

NewFromBytes decodes the filter from a sequence of bytes.

Note: data will be referenced inside the table.

func NewOptimal

func NewOptimal(expectedElements int, falsePositiveRate float64) *Filter

NewOptimal returns a filter based on expected element count and false positive rate.

func NewOptimalMaxSize added in v0.16.0

func NewOptimalMaxSize(expectedElements int, falsePositiveRate float64, maxSize memory.Size) *Filter

NewOptimalMaxSize returns a filter based on expected element count and false positive rate, capped at a maximum size in bytes

func (*Filter) Add

func (filter *Filter) Add(pieceID storj.PieceID)

Add adds an element to the bloom filter

func (*Filter) Bytes

func (filter *Filter) Bytes() []byte

Bytes encodes the filter into a sequence of bytes that can be transferred on network.

func (*Filter) Contains

func (filter *Filter) Contains(pieceID storj.PieceID) bool

Contains return true if pieceID may be in the set

func (*Filter) Parameters

func (filter *Filter) Parameters() (hashCount, size int)

Parameters returns filter parameters.

func (*Filter) Size added in v0.16.0

func (filter *Filter) Size() int64

Size returns the size of Bytes call.

Jump to

Keyboard shortcuts

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