pub struct Publisher { /* private fields */ }Expand description
Sender side: stamps batches with the subscription epoch + schema_fp and drives
the gap-free seq. Graph-agnostic — the caller drains the change-sink and hands the
CaughtChanges here.
Implementations§
Source§impl Publisher
impl Publisher
Sourcepub fn new(epoch: u64, view_schema: &Schema) -> Publisher
pub fn new(epoch: u64, view_schema: &Schema) -> Publisher
Open a publisher at epoch over a hierarchical view Schema. Bump epoch
for each fresh (re-)subscription so the receiver can reject stale batches.
Sourcepub fn snapshot(&mut self, caught: &[CaughtChange]) -> Batch
pub fn snapshot(&mut self, caught: &[CaughtChange]) -> Batch
The hydrate snapshot (the flat Adds from
Graph::try_hydrate_change_sink) as a
single batch (seq 0). Always emitted — even for an empty result — so the receiver
learns the snapshot is complete. For a large result prefer snapshot_chunks.
Sourcepub fn snapshot_chunks(
&mut self,
caught: &[CaughtChange],
max_per_chunk: usize,
) -> Vec<SnapshotChunk>
pub fn snapshot_chunks( &mut self, caught: &[CaughtChange], max_per_chunk: usize, ) -> Vec<SnapshotChunk>
The hydrate snapshot as a sequence of SnapshotChunks of at most
max_per_chunk top-level entries each (the last chunk carries last = true).
Use this instead of snapshot when the result is large:
the snapshot is O(full result), so a single batch can blow a transport frame /
pin peak memory. An empty result still yields one terminal (last) chunk so the
receiver gets the completion marker.
Reserves the seq-0 slot for the baseline — incremental commits
start at seq 1, exactly as after snapshot. Call this
(or snapshot) once, before any commit.
Sourcepub fn commit(&mut self, caught: &[CaughtChange]) -> Option<Batch>
pub fn commit(&mut self, caught: &[CaughtChange]) -> Option<Batch>
Wrap one transaction’s drained changes
(Graph::take_sink_changes). Returns
None for an empty transaction — no batch, no seq consumed — keeping seq
gap-free over emitted batches.