filter

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 8 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 wrapper around cuckoo filter

func FilterDecode

func FilterDecode(d *storage.Decoder) *Filter

FilterDecode decodes a filter from a byte slice

func NewFilter

func NewFilter() *Filter

NewFilter creates the Filter

func (*Filter) Commit

func (f *Filter) Commit() error

Commit commits the buffer into a cuckoo filter

func (*Filter) Encode

func (f *Filter) Encode(e *storage.Encoder) error

Encode encodes the filter into byte slice

func (*Filter) Insert

func (f *Filter) Insert(data []byte) *Filter

Insert inserts data into a buffer but not yet available to be used

func (*Filter) Lookup

func (f *Filter) Lookup(data []byte) (bool, error)

type Options

type Options struct {
	// NumIntial is the capacity initially
	NumInitial uint32
	// ScalingFactor decides the amount of increase in size
	ScalingFactor float32
	// FalsePositive is the target false positive rate
	FalsePositive float64
	// TighteningRatio is the factor by which the subsequent false positive decreases
	TighteningRatio float32
	// FillRatio approximates ratio of 1s to size of bitset
	FillRatio float32
}

Options contains information for GrowingFilter

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the default options which is subjectively suitable for the author's use-case

func OptionsDecode

func OptionsDecode(d *storage.Decoder) Options

func (Options) Encode

func (o Options) Encode(e *storage.Encoder)

Encode encodes to the encoder

Jump to

Keyboard shortcuts

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