Help us shape the future of Go! Take the 2026 Go Developer Survey

bloomer

package module
v0.0.0-...-73f8371 Latest Latest
Warning

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

Go to latest
Published: May 1, 2014 License: Unlicense Imports: 5 Imported by: 0

README

bloomer

Simple bloom filter in golang.

usage


import (
  "fmt"
  "github.com/emef/bloomer"
)

// create bloom filter with estimated 1 million elements
// and a false positive probability of 0.001
set := bloomer.NewSuggested(1e6, 1e-3)

// add some items
set.Add([]byte("hi, my name is"))
set.Add([]byte("..."))

// check membership:
fmt.Println("expect true:", set.Get([]byte("hi, my name is")))
fmt.Println("expect false:", set.Get([]byte("missing")))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bloomer

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

func New

func New(size, k int) *Bloomer

func NewSuggested

func NewSuggested(n int, p float64) *Bloomer

func (Bloomer) Add

func (b Bloomer) Add(value []byte)

func (Bloomer) Test

func (b Bloomer) Test(value []byte) bool

func (Bloomer) TestAndSet

func (b Bloomer) TestAndSet(value []byte) bool

Jump to

Keyboard shortcuts

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