Skip to main content

Module spill

Module spill 

Source
Expand description

Spill strategies and policies for MergeQueue entries under memory pressure.

Three traits compose here:

  • SpillPolicy decides whether and how a queue should be reshaped at each extend. It is handed the raw VecDeque<QueueEntry> under the queue’s mutex and may replace entries freely.
  • BytesSpill decides where bytes go when a policy chooses to spill. Pluggable: file, object store, mlock pool, in-memory mock for tests.
  • BytesFetch is the handle returned by a BytesSpill; 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.

Re-exports§

pub use threshold::Threshold;
pub use prefetch::PrefetchPolicy;

Modules§

prefetch
Reader-side policy: materializes Paged entries near the front.
threshold
Writer-side spill policy: threshold-based, spills the middle of the queue.

Traits§

BytesFetch
A consume-once handle to bytes previously written via a BytesSpill.
BytesSpill
A type that can convert runs of bytes into runs of boxed bytes retrieval.
SpillPolicy
Inspects and optionally rewrites a MergeQueue’s entries.

Type Aliases§

SpillPolicyFn
A function that produces pairs of writer and reader SpillPolicys.