Expand description
Spill strategies and policies for MergeQueue entries under memory pressure.
Three traits compose here:
SpillPolicydecides whether and how a queue should be reshaped at eachextend. It is handed the rawVecDeque<QueueEntry>under the queue’s mutex and may replace entries freely.BytesSpilldecides where bytes go when a policy chooses to spill. Pluggable: file, object store, mlock pool, in-memory mock for tests.BytesFetchis the handle returned by aBytesSpill; it reads the spilled bytes back, consuming itself in the process.
The shipped threshold::Threshold pairs a BytesSpill strategy with
threshold/reserve/budget knobs and encodes the “spill the middle of the
queue when resident bytes get too large” heuristic. Other policies can
make entirely different decisions (memory-pressure-driven, periodic,
manual trigger, adaptive) using the same strategies.
Modules§
- prefetch
- Reader-side policy: materializes
Pagedentries near the front. - threshold
- Writer-side spill policy: threshold-based, spills the middle of the queue.
Structs§
- Prefetch
Policy - A reader-side
SpillPolicythat materializesPagedentries near the front of the queue up to a byte budget. The writer-side dual ofsuper::threshold::Threshold: the writer pages data out, the reader pages data back in — both throughSpillPolicy::apply. - Threshold
- A threshold-based
SpillPolicy: when a queue’s resident-byte count exceedshead_reserve_bytes + threshold_bytes, spill all entries past the head reserve (except the last entry, which stays as thetry_mergetarget).
Traits§
- Bytes
Fetch - A consume-once handle to bytes previously written via a
BytesSpill. - Bytes
Spill - A type that can convert runs of bytes into runs of boxed bytes retrieval.
- Spill
Policy - Inspects and optionally rewrites a
MergeQueue’s entries.
Type Aliases§
- Spill
Policy Fn - A function that produces pairs of writer and reader
SpillPolicys.