pub struct FamilyBuffer { /* private fields */ }Expand description
Buffers a family’s rows under an exact byte budget, spilling deterministically
to a ProtectedSpool the moment a push would cross the budget.
The buffer never retains every child row in an unbounded Vec: once spilled,
each further row is written straight to the protected spool. The spill
decision is deterministic — it depends only on the (fixed) budget and the
rows pushed, not on wall-clock or allocation timing — so a given plan spills
identically on every run.
Implementations§
Source§impl FamilyBuffer
impl FamilyBuffer
Sourcepub fn new(
budget: FamilyBudget,
table_id: u32,
temp: TempConfig,
spill_kind: SpillKind,
) -> Self
pub fn new( budget: FamilyBudget, table_id: u32, temp: TempConfig, spill_kind: SpillKind, ) -> Self
A buffer that starts in memory and spills on demand.
Sourcepub fn with_estimate(
budget: FamilyBudget,
table_id: u32,
temp: TempConfig,
spill_kind: SpillKind,
estimated_bytes: u64,
) -> Result<Self>
pub fn with_estimate( budget: FamilyBudget, table_id: u32, temp: TempConfig, spill_kind: SpillKind, estimated_bytes: u64, ) -> Result<Self>
A buffer that chooses its storage up front from an estimate: if the family is already known to exceed the budget it spills before the first row, avoiding a transient in-memory spike.
Sourcepub fn is_spilled(&self) -> bool
pub fn is_spilled(&self) -> bool
Whether the buffer has spilled to disk.
Sourcepub fn state(&self) -> &FamilyState
pub fn state(&self) -> &FamilyState
The current storage state.
Sourcepub fn push(&mut self, row: SpooledRow) -> Result<()>
pub fn push(&mut self, row: SpooledRow) -> Result<()>
Buffer one row, spilling to a protected spool if it would cross the budget.
Sourcepub fn replay_rows(&mut self) -> Result<FamilyRowReplay<'_>>
pub fn replay_rows(&mut self) -> Result<FamilyRowReplay<'_>>
Replay buffered rows in push order without materializing a spilled family in memory.
Sourcepub fn drain_rows(&mut self) -> Result<Vec<SpooledRow>>
pub fn drain_rows(&mut self) -> Result<Vec<SpooledRow>>
Collect every buffered row in push order.
Prefer replay_rows on generation paths: this
compatibility helper intentionally materializes the result for callers
that need an owned collection.
Auto Trait Implementations§
impl Freeze for FamilyBuffer
impl RefUnwindSafe for FamilyBuffer
impl Send for FamilyBuffer
impl Sync for FamilyBuffer
impl Unpin for FamilyBuffer
impl UnsafeUnpin for FamilyBuffer
impl UnwindSafe for FamilyBuffer
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more