bf

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0, MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bloomfilter

type Bloomfilter struct {
	Filter            bitvector // our filter bit vector
	M                 uint32    // size of bit vector in bits
	K                 uint32    // distinct hash functions needed
	FalsePositiveRate float64
	Capacity          int
}

doorkeeper is a small bloom-filter-based cache admission policy

func New

func New(falsePositiveRate float64) *Bloomfilter

func NewWithSize

func NewWithSize(size uint32) *Bloomfilter

create new bloomfilter with given size in bytes

func (*Bloomfilter) EnsureCapacity

func (d *Bloomfilter) EnsureCapacity(capacity int)

func (*Bloomfilter) Exist

func (d *Bloomfilter) Exist(h uint64) bool

func (*Bloomfilter) Insert

func (d *Bloomfilter) Insert(h uint64) bool

insert inserts the byte array b into the bloom filter. Returns true if the value was already considered to be in the bloom filter.

func (*Bloomfilter) Reset

func (d *Bloomfilter) Reset()

Reset clears the bloom filter

Jump to

Keyboard shortcuts

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