A Bloom filter for instances of T
.
A Funnel
is a type class for an object which can send data from an object
of type T
into a PrimitiveSink
.
A Funnel
is a type class for an object which can send data from an object
of type T
into a PrimitiveSink
.
Note that serialization of a BloomFilter requires the proper serialization of funnels.
From the Guava Funnel tutorial:
// A Funnel describes how to decompose a particular object type into primitive field values. // For example, if we had case class Person(id: Integer, firstName: String, lastName: String, birthYear: Int) // our Funnel might look like implicit val personFunnel = new Funnel[Person] { override def funnel(person: Person, into: PrimitiveSink) = { into .putInt(person.id) .putString(person.firstName, Charsets.UTF_8) .putString(person.lastName, Charsets.UTF_8) .putInt(person.birthYear) } }
0.6 (copied from Guava-libraries)
Factory for BloomFilters
Factory for BloomFilters
In order to be able to create a BloomFilter[T]
an implementation of a
Funnel for T
(called type class) must be in implicit scope (recommended)
or passed explicitly as a parameter.
Utility functions for the work with Funnel.
Utility functions for the work with Funnel.
Usage example for conversion between Guava and Mango:
// convert a Guava Funnel[T] to a Mango Funnel[T] import com.google.common.hash.{ Funnel => GuavaFunnel } val guavaFunnel: GuavaFunnel[T] = ... val mangoFunnel: Funnel[T] = guavaFunnel.asScala import com.google.common.hash.{ Funnel => GuavaFunnel } val guavaFunnel: GuavaFunnel[CharSequence] = GuavaFunnels.stringFunnel val mangoFunnel: Funnel[CharSequence] = guavaFunnel.asScala
0.6
A Bloom filter for instances of
T
. A Bloom filter offers an approximate containment test with one-sided error: if it claims that an element is contained in it, this might be in error, but if it claims that an element is not contained in it, then this is definitely true.From the Guava BloomFilter tutorial:
The false positive probability (
FPP
) of a bloom filter is defined as the probability that#mightContain(T)
will erroneously returntrue
for an object that has not actually been put in theBloomFilter
.0.6 (copied from Guava-libraries)