pub struct PublicationQueue { /* private fields */ }Expand description
A bounded FIFO whose render-side operation performs no transport I/O.
A marker is returned only after the complete validated snapshot+commit pair has been encoded and admitted atomically. Full queues consume no revision. A transport failure permanently closes admission.
Implementations§
Source§impl PublicationQueue
impl PublicationQueue
Sourcepub fn new(client: Client, capacity: usize) -> Result<Self, Error>
pub fn new(client: Client, capacity: usize) -> Result<Self, Error>
Move a connected client into a dedicated writer thread.
Construct this only after the handshake; dormant applications never create a queue or thread. Capacity must be positive.
Sourcepub fn publish(
&mut self,
snapshot: &mut Snapshot,
) -> Result<Option<String>, Error>
pub fn publish( &mut self, snapshot: &mut Snapshot, ) -> Result<Option<String>, Error>
Validate, encode and non-blockingly admit one complete revision.
Sourcepub fn fail(&mut self, code: impl Into<String>, message: impl Into<String>)
pub fn fail(&mut self, code: impl Into<String>, message: impl Into<String>)
Fail closed without writing from the caller’s thread. Already-admitted revisions drain in order, then the worker sends the typed fatal.
Sourcepub fn shutdown(self) -> bool
pub fn shutdown(self) -> bool
Close admission, drain the ordered worker and wait for its causal completion. Framework lifecycle code calls this outside render hooks so a short-lived one-frame process cannot exit ahead of its semantic data. Returns whether the worker completed without a transport failure.