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
impl RpcClientPending
Sourcepub fn register(
&self,
call_id: u64,
target_node: NodeId,
) -> Receiver<RpcResponsePayload>
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.
Sourcepub fn register_streaming(
&self,
call_id: u64,
target_node: NodeId,
) -> UnboundedReceiver<StreamItem>
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.
Sourcepub fn register_client_streaming(
&self,
call_id: u64,
target_node: NodeId,
) -> (Receiver<RpcResponsePayload>, UnboundedReceiver<u32>)
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).
Sourcepub fn register_duplex(
&self,
call_id: u64,
target_node: NodeId,
) -> (UnboundedReceiver<StreamItem>, UnboundedReceiver<u32>)
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).
Sourcepub fn cancel(&self, call_id: u64)
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.