BloomFilter class final
Bloom filter used to skip segments that cannot contain a key.
Ten bits per key with seven probes gives roughly a 1% false-positive rate.
The serialized form is [u32 bitCount][u8 hashCount][bits], little-endian.
Probes use double hashing over CRC-32C: h1 + i * h2. Both are 32-bit, and
the intermediate i * h2 stays below 2^35, so this is exact on dart2js.
Constructors
Properties
- bitCount → int
-
Total number of bits.
final
- bits → Uint8List
-
Backing bits.
final
- byteLength → int
-
Serialized size in bytes.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hashCount → int
-
Number of probes per key.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Uint8List key) → void -
Adds
keyto the filter. -
mightContain(
Uint8List key) → bool -
Whether
keymay be present. False positives are possible; false negatives are not. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toBytes(
) → Uint8List - Serializes the filter to a new buffer.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parse(
Uint8List source, [int offset = 0]) → ({BloomFilter filter, int next}) -
Parses a filter starting at
offset;nextreports the end offset.