Rindle docs and package mapSkip to main content

NormalizeFold

Struct NormalizeFold 

Source
pub struct NormalizeFold { /* private fields */ }
Expand description

The server-side serializer (§4): one per registered normalized query. Fold each committed transaction’s CaughtChanges with fold to get that tick’s NormalizedOps. The footprint persists across ticks; the snapshot is simply the first fold over the hydrate batch (every row 0→1 ⇒ all Adds).

Implementations§

Source§

impl NormalizeFold

Source

pub fn new(ast: &Ast, pk: PkMap) -> NormalizeFold

Build a fold for the query ast, with pk giving each table’s primary-key column indices (the server derives this from its source schemas; tests pass it inline). Panics if pk omits a table the query’s tree can surface — a build-time config invariant, not a data-reachable error.

Source

pub fn tree(&self) -> &TableNode

The query’s table tree (slot → child table), derived from the AST.

Source

pub fn footprint_snapshot(&self) -> Vec<NormalizedOp>

The current footprint as a seq-0 snapshot: one NormalizedOp::Add per live row, in deterministic (sorted by table, then PK) order. This baselines a late subscriber attaching to an already-hydrated shared query from the cached footprint, without re-running the engine pipeline (RINDLE-SERVER-DESIGN.md §11) — the membership is binary on the wire, so the intra-query refcount is not surfaced.

Source

pub fn fold(&mut self, changes: &[CaughtChange]) -> Vec<NormalizedOp>

Fold one committed transaction (or the hydrate snapshot) into its net NormalizedOps, updating the persistent footprint. An empty / no-membership- change tick returns [].

Source

pub fn fold_footprint_only(&mut self, changes: &[CaughtChange])

Update the footprint for one transaction without producing wire ops — the allocation-light path for a query nobody is currently receiving (a pinned, zero- subscriber materialization) and for the hydrate fold (whose ops the drain discards, baselining late subscribers off footprint_snapshot instead). It skips the per-tick diff map (the Tick), the tick-start row capture, and the emit pass entirely — exactly the allocations the wiki-demo RSS profiling traced the glibc retention to. The footprint it leaves is byte-identical to what fold would leave, so a later subscriber’s snapshot is unaffected.

Trait Implementations§

Source§

impl Debug for NormalizeFold

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

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<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, 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.