Skip to content

BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:113

A blocked (split-block) Bloom filter: confines every lookup to a single cache line, trading ~15% more space for higher lookup throughput and a lower FPR.

const filter = BlockedBloomFilter.create(100_000, 0.01);
filter.add("alice");
filter.has("alice"); // true

new BlockedBloomFilter(__namedParameters): BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:158

Constructs a filter from low-level BlockedBloomParams. Prefer BlockedBloomFilter.create unless restoring a specific configuration.

BlockedBloomParams

BlockedBloomFilter

get bitsPerKey(): number

Defined in: packages/distillate/src/blocked/blocked.ts:187

Actual bits allocated per key (total bits / capacity).

number


get length(): number

Defined in: packages/distillate/src/blocked/blocked.ts:202

Number of bits currently set across all lanes.

number


get numBlocks(): number

Defined in: packages/distillate/src/blocked/blocked.ts:192

Number of 256-bit blocks; one of the two fields union requires to match.

number


get seed(): number

Defined in: packages/distillate/src/blocked/blocked.ts:197

Hash seed; the other field union requires to match.

number

add(key): void

Defined in: packages/distillate/src/blocked/blocked.ts:341

Adds a key to the set.

BytesLike

The key to insert, as a string or bytes.

void


equals(other): boolean

Defined in: packages/distillate/src/blocked/blocked.ts:289

Tests structural equality: true when other serializes to identical bytes, meaning identical parameters and set bits.

BlockedBloomFilter

The filter to compare against.

boolean

true if the two filters are byte-for-byte identical.


has(key): boolean

Defined in: packages/distillate/src/blocked/blocked.ts:355

Tests whether a key is in the set.

BytesLike

The key to test.

boolean

true if present (possibly a false positive); false guarantees absence.


rate(): number

Defined in: packages/distillate/src/blocked/blocked.ts:221

Estimates the current false-positive rate from the actual fill, (length / totalBits) ** 8. A split-block query checks exactly 8 lane-bits, so the exponent is 8 rather than a classic probe count k. This reflects how full the filter is right now, not the design target.

number

The estimated false-positive rate, 0 for an empty filter.


toBytes(): Uint8Array

Defined in: packages/distillate/src/blocked/blocked.ts:264

Serializes the filter to a portable little-endian byte layout.

Uint8Array

The serialized filter, readable by BlockedBloomFilter.fromBytes.


toJSON(): FilterJSON

Defined in: packages/distillate/src/blocked/blocked.ts:299

Serializes the filter to a JSON-friendly envelope wrapping the base64 of BlockedBloomFilter.toBytes.

FilterJSON

The envelope, readable by BlockedBloomFilter.fromJSON.


union(other): BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:320

Returns a new filter containing the union of this filter and other.

BlockedBloomFilter

A filter built with identical parameters.

BlockedBloomFilter

A new filter reporting membership for keys in either input.

BlockedBloomParamMismatchError if the parameters differ.


static create(n, epsilon): BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:128

Creates a filter sized for n expected keys at a target false-positive rate.

number

Expected number of keys.

number

Target false-positive rate, e.g. 0.01 for 1%.

BlockedBloomFilter

A new, empty filter.


static from(keys, epsilon): BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:147

Builds a filter from keys, sized for their count at the target false-positive rate. The ergonomic entry point when the key set is already in hand; use BlockedBloomFilter.create to size for a count known ahead.

Iterable<BytesLike>

The keys to insert.

number

Target false-positive rate, e.g. 0.01 for 1%.

BlockedBloomFilter

A new filter containing every key.


static fromBytes(bytes): BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:231

Restores a filter from its BlockedBloomFilter.toBytes serialization.

Uint8Array

The serialized filter.

BlockedBloomFilter

The reconstructed filter.


static fromJSON(value): BlockedBloomFilter

Defined in: packages/distillate/src/blocked/blocked.ts:309

Restores a filter from its BlockedBloomFilter.toJSON envelope.

unknown

The JSON envelope.

BlockedBloomFilter

The reconstructed filter.