pub struct NormalizedPublisher { /* private fields */ }Expand description
Sender side: wraps a NormalizeFold, stamps batches with the subscription epoch +
normalized_fp, and drives the gap-free seq. The caller drains the change-sink (the
replica’s per-query CaughtChanges) and hands them to snapshot /
commit.
Implementations§
Source§impl NormalizedPublisher
impl NormalizedPublisher
Sourcepub fn new(
epoch: u64,
ast: &Ast,
schemas: Vec<TableWireSchema>,
) -> NormalizedPublisher
pub fn new( epoch: u64, ast: &Ast, schemas: Vec<TableWireSchema>, ) -> NormalizedPublisher
Open a publisher at epoch for ast, given the flat schema of every table the
query’s tree can surface (root + every related/EXISTS child table). Bump epoch
on a re-hydrate (§5.3). Panics if a surfaced table lacks a schema — a build-time
config invariant (mirrors NormalizeFold’s validate_pk).
Sourcepub fn hello(&self) -> &NormalizedHello
pub fn hello(&self) -> &NormalizedHello
The handshake to send before any batch.
Sourcepub fn snapshot(&mut self, caught: &[CaughtChange], cv: u64) -> NormalizedBatch
pub fn snapshot(&mut self, caught: &[CaughtChange], cv: u64) -> NormalizedBatch
The hydrate snapshot (the pipeline’s CaughtChange::Adds from
Graph::hydrate_change_sink) folded into a single seq-0 batch of add ops, at
commit version cv (the watermark the hydrate reflects — Update::Hydrated’s
tx_id). Always emitted — even for an empty result — so the receiver learns the
baseline is set. Reserves the seq-0 slot; increments start at seq 1. Call once,
before any commit.
Sourcepub fn commit(
&mut self,
caught: &[CaughtChange],
cv: u64,
) -> Option<NormalizedBatch>
pub fn commit( &mut self, caught: &[CaughtChange], cv: u64, ) -> Option<NormalizedBatch>
Wrap one transaction’s drained changes, stamped with the transaction’s commit
version cv (Update::Changed’s tx_id). Folds them through the persistent
footprint and emits the net membership deltas. Returns None for a transaction
that produced no net op — no batch, no seq consumed — keeping seq gap-free
over emitted batches (an empty source tx, or one whose effects cancel within the
footprint).