Skip to main content

RpcClientPending

Struct RpcClientPending 

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

Shared pending-call state. Held by both the RpcClientFold (writer side: completes oneshot senders / pushes streaming chunks on RESPONSE arrival) and the Mesh::call* APIs (reader side: registers entries before publishing the REQUEST). Concurrent access is mediated by DashMap.

Multiplexes unary AND streaming calls in a single map keyed on call_id — the entry’s enum variant tells the fold how to dispatch incoming RESPONSE events.

Implementations§

Source§

impl RpcClientPending

Source

pub fn new() -> Self

Construct an empty pending-call store.

Source

pub fn register( &self, call_id: u64, target_node: NodeId, ) -> Receiver<RpcResponsePayload>

Register a oneshot for a unary call_id. Returns the receiver the caller awaits. The caller MUST publish the REQUEST after registration (and not before) so the matching RESPONSE can’t arrive while the pending entry is missing.

target_node is the wire-session peer the request will be sent to; deliver rejects RESPONSE frames whose from_node doesn’t match. Pass 0 for loopback / no- session test paths to opt out of the binding gate.

If a sender already exists for call_id (improperly reused id), it is replaced and the old receiver gets a RecvError::Closed — surfacing the misuse as a hard error at the caller rather than silently delivering the response to the wrong waiter.

Source

pub fn register_streaming( &self, call_id: u64, target_node: NodeId, ) -> UnboundedReceiver<StreamItem>

Register a streaming entry for call_id. Returns the receive end of an mpsc the fold will push chunks onto. Same registration ordering rules as register — publisher must call this BEFORE publishing the REQUEST.

Source

pub fn register_client_streaming( &self, call_id: u64, target_node: NodeId, ) -> (Receiver<RpcResponsePayload>, UnboundedReceiver<u32>)

Register a client-streaming (or duplex) entry for call_id. Returns BOTH the terminal-response receiver (the caller awaits on this for the single terminal RESPONSE that ends the call) AND a grant receiver (the caller’s send sink consumes this to gate send().await when the caller opted into request-direction flow control).

Same registration ordering rules as register / register_streaming — publisher must call this BEFORE publishing the REQUEST so a fast server’s RESPONSE / REQUEST_GRANT can’t arrive while no pending entry exists.

Bidi streaming plan (Phase C).

Source

pub fn register_duplex( &self, call_id: u64, target_node: NodeId, ) -> (UnboundedReceiver<StreamItem>, UnboundedReceiver<u32>)

Register a duplex entry for call_id. Returns BOTH a response-chunk receiver (yields StreamItem per inbound RESPONSE chunk; terminator is End / Error) AND a grant receiver (yields u32 credits per inbound REQUEST_GRANT).

Same registration ordering rules as the other register_* methods: publisher must call this BEFORE publishing the REQUEST so the server’s response chunks / grants can’t arrive while no pending entry exists.

Bidi streaming plan (Phase D).

Source

pub fn cancel(&self, call_id: u64)

Drop the pending entry for call_id. Called by the caller-side cancellation path (e.g. Mesh::call’s future being dropped, the stream being dropped, or a deadline timer firing). The matching RESPONSE(s) that may still arrive afterwards are silently discarded by deliver.

Trait Implementations§

Source§

impl Default for RpcClientPending

Source§

fn default() -> Self

Returns the “default value” for a type. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more