a2filter

package module
v0.0.0-...-44425cd Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2016 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Overview

Package a2filter implements a SipHash-2-4 based Active-Active Bloom Filter. It is designed to be stable over time even when filled to max capacity by implementing the active-active buffering (A2 buffering) scheme presented in "Aging Bloom Filter with Two Active Buffers for Dynamic Sets" (MyungKeun Yoon).

Note that none of the operations on the filter are constant time, and the the max backing Bloom Filter size is limited to 2^31 bytes. This package is threadsafe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2Filter

type A2Filter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

A2Filter is an Active-Active Bloom Filter.

func New

func New(rand io.Reader, mLn2 int, p float64) (*A2Filter, error)

New constructs a new A2Filter with a filter set size 2^mLn2, and false postive rate p. The actual in memory footprint of the datastructure will be approximately 2^(mLn2+1) bits due to the double buffered nature of the filter.

func (*A2Filter) MaxEntries

func (f *A2Filter) MaxEntries() int

MaxEntries returns the maximum capacity of the A2Filter. This value is usually an underestimate as the filter is double buffered, however entry count accounting is only done for Active1, so Active2 should be ignored in calculations.

func (*A2Filter) TestAndSet

func (f *A2Filter) TestAndSet(b []byte) bool

TestAndSet tests the A2Filter for a given value's membership, adds the value to the filter and returns if it was present at the time of the call.

Jump to

Keyboard shortcuts

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