Struct network::protocols::rpc::InboundRpcs
source · pub struct InboundRpcs { /* private fields */ }
Expand description
InboundRpcs
handles new inbound rpc requests off the wire, notifies the
PeerManager
of the new request, and stores the pending response on a queue.
If the response eventually completes, InboundRpc
records some metrics and
enqueues the response message onto the outbound write queue.
There is one InboundRpcs
handler per Peer
.
Implementations§
source§impl InboundRpcs
impl InboundRpcs
pub fn new( network_context: Arc<NetworkContext>, time_service: TimeService, remote_peer_id: PeerId, inbound_rpc_timeout: Duration, max_concurrent_inbound_rpcs: u32 ) -> Self
sourcepub fn handle_inbound_request(
&mut self,
peer_notifs_tx: &mut Sender<ProtocolId, PeerNotification>,
request: RpcRequest
) -> Result<(), RpcError>
pub fn handle_inbound_request( &mut self, peer_notifs_tx: &mut Sender<ProtocolId, PeerNotification>, request: RpcRequest ) -> Result<(), RpcError>
Handle a new inbound RpcRequest
message off the wire.
sourcepub fn next_completed_response(
&mut self
) -> impl Future<Output = Result<RpcResponse, RpcError>> + FusedFuture + '_
pub fn next_completed_response( &mut self ) -> impl Future<Output = Result<RpcResponse, RpcError>> + FusedFuture + '_
Method for Peer
actor to drive the pending inbound rpc tasks forward.
The returned Future
is a FusedFuture
so it works correctly in a
futures::select!
.
sourcepub async fn send_outbound_response(
&mut self,
write_reqs_tx: &mut Sender<(NetworkMessage, Sender<Result<(), PeerManagerError>>)>,
maybe_response: Result<RpcResponse, RpcError>
) -> Result<(), RpcError>
pub async fn send_outbound_response( &mut self, write_reqs_tx: &mut Sender<(NetworkMessage, Sender<Result<(), PeerManagerError>>)>, maybe_response: Result<RpcResponse, RpcError> ) -> Result<(), RpcError>
Handle a completed response from the application handler. If successful, we update the appropriate counters and enqueue the response message onto the outbound write queue.