bloomfilter

package
v0.14.9 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: AGPL-3.0 Imports: 5 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 (*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.

Jump to

Keyboard shortcuts

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