Expand description
DNF bitmap index queries over ordered bucket streams.
Callers build a BitmapQuery as an OR of terms. Each term is an AND of
signed dimension-key literals. Evaluation yields matching bitmap members as
they are produced. Back-pressure from downstream consumers, e.g. a
.take(page_size), propagates back to the backend-provided bucket streams
and avoids materializing matches we won’t use.
Queries are intentionally restricted to anchored DNF: every term must contain
at least one positive literal. Positive literals give the evaluator concrete
bitmap streams to scan and intersect; negative literals only shrink those
candidate streams. Negative-only terms such as NOT sender = A are
supported by anchoring them upstream on a universe include — a stored
existence marker in event-space (EventExtant), a scan-time-synthesized
dense leaf in tx-space (TxUniverse, see dense_universe_buckets) — so
the evaluator itself stays a set of ordered stream merge-joins with no
complement-specific code path. The full-range scan such a term implies is
inherent to negation and is bounded by the per-request bucket budget.
Backends provide one ordered (bucket_id, RoaringBitmap) stream or iterator
per dimension key. The merge-join machinery here is storage-agnostic:
BigTable, RocksDB, or any other backend can reuse it as long as its bucket
source is sparse, ordered by the requested scan direction, and stores bitmap
positions relative to that bucket.
Structs§
- Bitmap
Key - Validated
[dimension_tag][dimension_value]lookup key. - Bitmap
Query - A DNF query over bitmap dimension scans.
- Bitmap
Scan Metrics - Per-request bucket-scan accounting, delivered via the
on_metricscallback passed toeval_bitmap_query_stream. Fires once when the eval pipeline is dropped (natural end, error, or consumer cancel). The sole exception is the budget-misconfig early-out, which errors before any scan is set up and emits nothing. - Bitmap
Term - One conjunction in a DNF bitmap query.
Enums§
- Bitmap
Literal - One signed dimension-key literal in a bitmap term.
- Bitmap
Scan Error - Terminal signal raised by a bitmap evaluator on the bucket channel’s
Err. It must be an error rather than a silent end-of-stream: the driver reads a clean end as “scanned the whole range” and advances the resume cursor to the terminus, so a budget or cancel stop has to short-circuit thetry_stream!pipeline to truncate the scan at the current floor. The variant is chosen at the source, so each List handler maps it to a wire outcome with one exhaustive match. - Scan
Direction - Watermarked
- Item or progress watermark flowing through a bitmap eval pipeline.
Watermark(p)means every Item with position strictly beforepin scan direction has been emitted upstream. Downstream stages must preserve watermark/item ordering — that’s what makes the watermark a safe resume cursor on timeout.
Traits§
- Bitmap
Bucket Iterator Source - Storage backend that can scan one bitmap dimension key synchronously.
- Bitmap
Bucket Source - Storage backend that can scan one bitmap dimension key over a member range.
Functions§
- buckets_
with_ watermarks - Convenience adapter: wrap a single raw
BucketStreaminto aWatermarkedBucketStreamwith oneWatermark(post_bucket)after each bucket plus one final at the range terminus on EOF. - dense_
universe_ buckets - Synthesized bucket sequence for the dense tx-seq universe: one full bitmap
per bucket touched by
range, in scan-direction order. Backends return this for the query-onlyIndexDimension::TxUniversekey instead of reading storage — the tx-seq namespace is dense, so the universe is computable. - eval_
bitmap_ query_ bucket_ iter - Evaluate a DNF
BitmapQueryas an ordered iterator of marked bucket bitmaps. Output emitsWatermarked::Item((bucket_id, bitmap))interleaved withWatermarked::Watermark(p)derived from the slowest leaf’s progress. - eval_
bitmap_ query_ stream - Evaluate a DNF
BitmapQueryagainst a backend-provided bitmap source. - flatten_
watermarked_ buckets - Flatten marked bucket bitmaps into absolute member ids with
edge-bucket trimming against
range. Watermarks pass through unchanged.
Type Aliases§
- Bitmap
Scan Result - Bucket
Item - A stream of
(bucket_id, RoaringBitmap)in the requested bucket order. Bitmap positions are relative to the bucket (u32 offsets[0, BUCKET_SIZE)) - Bucket
Stream - Watermarked
Bucket Stream