pub struct SnapshotThenStream<TSnapshot, TPublication> { /* private fields */ }Expand description
Coordinates REST snapshot hydration with a live protobuf channel.
Implementations§
Source§impl<TSnapshot, TPublication> SnapshotThenStream<TSnapshot, TPublication>
impl<TSnapshot, TPublication> SnapshotThenStream<TSnapshot, TPublication>
pub fn new(cfg: SnapshotThenStreamConfig<TSnapshot, TPublication>) -> Self
Sourcepub async fn start(&self) -> Result<()>
pub async fn start(&self) -> Result<()>
Begin websocket streaming and perform the initial snapshot refresh.
Sourcepub async fn refresh_snapshot(&self) -> Result<()>
pub async fn refresh_snapshot(&self) -> Result<()>
Fetch a REST snapshot and merge buffered publications.
On failure, readiness stays false, Self::err is set, and the pending
buffer is retained so a successful retry merges each buffered publication
exactly once. Success clears err.
Sourcepub fn request_refresh(&self)
pub fn request_refresh(&self)
Request a snapshot refresh from a sync context (e.g. sequence gap handler).
Requests are coalesced behind one worker. A request arriving during a fetch schedules a follow-up, while repeated failures or persistent gaps fail closed after a bounded number of attempts.
pub fn is_ready(&self) -> bool
pub fn is_disposed(&self) -> bool
Sourcepub fn set_on_error<F>(&self, callback: F)
pub fn set_on_error<F>(&self, callback: F)
Register a callback for transport, decode, snapshot, and terminal buffering errors.
If an error was already recorded, the callback is invoked immediately. Callback panics are isolated from the stream worker.