New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bidirectional serialization of Bloom filters #3

Open
ocharles opened this Issue Feb 24, 2013 · 3 comments

Comments

Projects
None yet
4 participants
@ocharles

ocharles commented Feb 24, 2013

I'd like to use bloomfilter in order to let clients filter a large set on the server, while making efficient use of bandwidth. As such, clients will construct a Bloom filter themselves, transmit it over the network, and the server will use this Bloom filter against a local set it maintains. The result will then be transmitted over the network back to the client.

While I can get access to the underlying representation of a filter, I do not appear to be able to recreate the filter from it.

@kim

This comment has been minimized.

Show comment
Hide comment
@kim

kim Apr 30, 2014

This is actually possible, though not too obvious from just looking at the API:

let (bits,nh) = suggestSizing 3 0.1
     hfam     = cheapHashes nh
     filt     = fromList hfam bits ["foo", "bar", "quux"]
     arr      = bitArray filt -- warnings about endianness and word size apply
     filt'    = empty hfam bits -- must use the same parameters when re-creating the filter
 in filt' { bitArray = arr } 

(note: the hackage version exposes a slightly different API)

kim commented Apr 30, 2014

This is actually possible, though not too obvious from just looking at the API:

let (bits,nh) = suggestSizing 3 0.1
     hfam     = cheapHashes nh
     filt     = fromList hfam bits ["foo", "bar", "quux"]
     arr      = bitArray filt -- warnings about endianness and word size apply
     filt'    = empty hfam bits -- must use the same parameters when re-creating the filter
 in filt' { bitArray = arr } 

(note: the hackage version exposes a slightly different API)

@bgamari

This comment has been minimized.

Show comment
Hide comment
@bgamari

bgamari May 27, 2014

Contributor

Can this be closed?

Contributor

bgamari commented May 27, 2014

Can this be closed?

@gibiansky

This comment has been minimized.

Show comment
Hide comment
@gibiansky

gibiansky Jul 26, 2015

It would be nice to get official support for this in the API.

gibiansky commented Jul 26, 2015

It would be nice to get official support for this in the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment