Rindle docs and package mapSkip to main content

Publisher

Struct Publisher 

Source
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

Source

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.

Source

pub fn hello(&self) -> Hello

The handshake to send first.

Source

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.

Source

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.

Source

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.

Source

pub fn epoch(&self) -> u64

The subscription epoch.

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.