filter

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MMin is the minimum Filter filter bits count.
	MMin = 2
	// KMin is the minimum number of keys.
	KMin = 1
	// Uint64Bytes is the number of bytes in type uint64.
	Uint64Bytes = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

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

Block is a filter block

func NewFilterBlock

func NewFilterBlock(b []byte) *Block

NewFilterBlock returns new filter block, it is used to test key presence in the filter.

func (*Block) Test

func (b *Block) Test(h uint64) bool

Test is used to test for key presence in the filter.

type Filter

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

Filter is an opaque Filter filter type.

func (*Filter) Add

func (b *Filter) Add(h uint64)

Add adds `key` to the filter.

func (*Filter) Bytes

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

Bytes returns the bytes backing the filter.

func (*Filter) Test

func (b *Filter) Test(h uint64) bool

Test returns whether `key` is found.

type Generator

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

Generator bloom filter generator.

func NewFilterGenerator

func NewFilterGenerator() *Generator

NewFilterGenerator returns a new filter generator.

func (*Generator) Append

func (b *Generator) Append(h uint64)

Append adds a key to the filter block.

func (*Generator) Bytes

func (b *Generator) Bytes() []byte

Bytes returns a slice to filter block contents.

func (*Generator) Finish

func (b *Generator) Finish() []byte

Finish finishes building the filter block and returns a slice to its contents.

Jump to

Keyboard shortcuts

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