Home

Awesome

Bloom Filter

GitHub license GoDoc Build Status

Bloom Filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970.

This implement is experimental to written Golang to prove the basic concept of Bloom Filter.

Install

go get github.com/kkdai/bloomfilter

Usage

    //Create a couting bloom filter expect size 100, false detect rate 0.01
	cbf := NewCountingBloomFilter(100, 0.01)
	
	//Add item into cbf
	cbf.Add([]byte("foo"))
	cbf.Add([]byte("john"))
	cbf.Add([]byte("tom"))

	//test 
	fmt.Println("Test cbf:", cbf.Test([]byte("tom"))) //return "true"

    //Remvoe item from cbf
	cbf.Remove([]byte("john"))
	
	//test again
	fmt.Println("Test cbf:", cbf.Test([]byte("john"))) //return "false"

Inspired

Project52

It is one of my project 52.

License

This package is licensed under MIT license. See LICENSE for details.