pub struct PipelinedSender { /* private fields */ }Expand description
A pipelined transfer connection: multiple chunk requests can be enqueued and in flight simultaneously, instead of a blocking one-at-a-time model.
Backed by a background sender task (see spawn_pipelined) that owns
the socket; this struct is just a cheap handle (an mpsc sender + a
liveness flag) and can be cloned freely if multiple call sites need to
share one pipelined connection.
Implementations§
Source§impl PipelinedSender
impl PipelinedSender
Sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
true if the underlying sender task is still running. Does not
guarantee the next request will succeed (the connection could die
between this check and the next enqueue), but is enough to decide
whether to keep using this sender or fall back to opening a new one.
Sourcepub async fn enqueue(
&self,
body: Vec<u8>,
) -> Result<impl Future<Output = Result<Vec<u8>, InvocationError>> + Send + use<>, InvocationError>
pub async fn enqueue( &self, body: Vec<u8>, ) -> Result<impl Future<Output = Result<Vec<u8>, InvocationError>> + Send + use<>, InvocationError>
Enqueue a pre-serialised TL request body and return a future that resolves when the server responds. Does not wait for the response itself - callers can enqueue several of these before awaiting any of them, which is exactly what gives this connection X > 1 (multiple chunk requests in flight at once on one socket).
Returns an error immediately if the sender task has already shut down (e.g. the connection died); otherwise returns a future that resolves to the eventual RPC result or a connection-failure error.
Trait Implementations§
Source§impl Clone for PipelinedSender
impl Clone for PipelinedSender
Source§fn clone(&self) -> PipelinedSender
fn clone(&self) -> PipelinedSender
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more