Rindle docs and package mapSkip to main content

Subscriber

Struct Subscriber 

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

Receiver side: a Receiver plus the protocol state, enforcing the §2.3/§5.4 rules. The baseline is established by either a single-shot apply of the seq-0 snapshot batch or a sequence of apply_snapshot_chunk calls; then incremental batches flow.

Implementations§

Source§

impl Subscriber

Source

pub fn open(hello: &Hello) -> Result<Subscriber, ProtocolError>

Open from a Hello: hard-reject a comparator-contract mismatch (§5.5), verify the advertised fingerprint matches the shipped schema, and build the receiver from that schema. Apply the snapshot next (single-shot or chunked).

Source

pub fn apply_snapshot_chunk( &mut self, chunk: &SnapshotChunk, ) -> Result<SnapStatus, ProtocolError>

Apply one SnapshotChunk of a chunked hydrate snapshot. Validates epoch + schema-fp + strict in-order chunk index, applies its adds, and on the last chunk transitions to live (snapshot complete — the tree may render). A re-delivered (or post-completion) chunk is a no-op SnapStatus::Duplicate; a chunk-index gap is a fatal ProtocolError::Gap (re-hydrate).

Source

pub fn apply(&mut self, batch: &Batch) -> Result<Applied, ProtocolError>

Apply one incremental Batch (or the single-shot seq-0 snapshot batch). Validates epoch + schema-fp + strict in-order seq, then folds the events in order. A duplicate (already-applied seq) is a no-op Applied::Duplicate; a gap is a fatal ProtocolError::Gap (re-hydrate).

Source

pub fn top(&self) -> &[RecvNode]

The reconstructed top-level result (root[""]). Valid to read once the snapshot is complete (snapshot_complete); mid-snapshot it is a partial tree (render only after completion — §5.4).

Source

pub fn epoch(&self) -> u64

The subscription epoch this subscriber accepts.

Source

pub fn snapshot_complete(&self) -> bool

Whether the hydrate snapshot is complete (the tree may render).

Source

pub fn last_seq(&self) -> Option<u64>

The last applied incremental seq (None until the snapshot is complete; Some(0) immediately after the snapshot, then the last applied batch seq).

Trait Implementations§

Source§

impl Debug for Subscriber

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.