pub struct PushWriter { /* private fields */ }Expand description
A cheap clone of a PushClient’s write half.
It writes Frame::Publish frames on the SAME socket the client receives pushes
on, so a background drain task can stream observability events upstream without a
second connection. Cloning is an Arc bump; the underlying socket and its write
lock are shared with the originating PushClient.
Implementations§
Source§impl PushWriter
impl PushWriter
Sourcepub fn publish(&self, channel: &str, payload: Vec<u8>) -> Result<(), SdkError>
pub fn publish(&self, channel: &str, payload: Vec<u8>) -> Result<(), SdkError>
Publish payload to channel on the shared connection.
Writes a single Frame::Publish carrying the opaque bytes verbatim (schema
id zero, an independent causal context — the server routes the reserved
observability channel straight to its notifier hook, so no schema negotiation
or ordering context is required). The write takes the shared writer lock, so
it never interleaves bytes with a concurrent push reply.
§Errors
Returns SdkError::Protocol when the publish frame cannot be encoded and
SdkError::Connection when it cannot be written to the socket or the writer
lock is poisoned.
Sourcepub fn reply(
&self,
correlation_id: u64,
payload: Vec<u8>,
) -> Result<(), SdkError>
pub fn reply( &self, correlation_id: u64, payload: Vec<u8>, ) -> Result<(), SdkError>
Send a correlated reply to a server push on the shared connection, echoing the
push’s correlation_id so the server matches the reply to its push.
Identical wire effect to PushClient::reply, but issued from a cheap
PushWriter clone so a BACKGROUND task (e.g. a long-running agent dispatch)
can answer its own push after it completes, without holding the full client or
blocking the serve loop. Shares the writer lock, so it never interleaves bytes
with a concurrent publish or reply.
§Errors
Returns SdkError::Protocol when the reply frame cannot be encoded and
SdkError::Connection when it cannot be written to the socket or the writer
lock is poisoned.
Trait Implementations§
Source§impl Clone for PushWriter
impl Clone for PushWriter
Source§fn clone(&self) -> PushWriter
fn clone(&self) -> PushWriter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more