Skip to main content

FamilyBuffer

Struct FamilyBuffer 

Source
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

Source

pub fn new( budget: FamilyBudget, table_id: u32, temp: TempConfig, spill_kind: SpillKind, ) -> Self

A buffer that starts in memory and spills on demand.

Source

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.

Source

pub fn table_id(&self) -> u32

The table id every pushed row is expected to carry.

Source

pub fn is_spilled(&self) -> bool

Whether the buffer has spilled to disk.

Source

pub fn state(&self) -> &FamilyState

The current storage state.

Source

pub fn push(&mut self, row: SpooledRow) -> Result<()>

Buffer one row, spilling to a protected spool if it would cross the budget.

Source

pub fn replay_rows(&mut self) -> Result<FamilyRowReplay<'_>>

Replay buffered rows in push order without materializing a spilled family in memory.

Source

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§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V