Skip to content

franciscoescher/gobloom

Repository files navigation

Bloom Filter

Bloom filter implementation in go.

Scalable Bloom Filter

package gobloom

import (
  "fmt"
  "github.com/franciscoescher/bloom"
)

func main() {
  bf, _ := gobloom.NewScalable(gobloom.ParamsScalable{
		InitialSize:         1000,
		FalsePositiveRate:   0.01,
		FalsePositiveGrowth: 2,
	})
	bf.Add([]byte("foo"))
	bf.Add([]byte("bar"))
	bf.Add([]byte("baz"))

	fmt.Println(bf.Test([]byte("foo"))) // true
	fmt.Println(bf.Test([]byte("bar"))) // true
	fmt.Println(bf.Test([]byte("baz"))) // true
	fmt.Println(bf.Test([]byte("qux"))) // false
}

About

Bloom filter implementation in golang

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages