Struct network::protocols::rpc::OutboundRpcs
source · pub struct OutboundRpcs { /* private fields */ }
Expand description
OutboundRpcs
handles new outbound rpc requests made from the application layer.
There is one OutboundRpcs
handler per Peer
.
Implementations§
source§impl OutboundRpcs
impl OutboundRpcs
pub fn new( network_context: Arc<NetworkContext>, time_service: TimeService, remote_peer_id: PeerId, max_concurrent_outbound_rpcs: u32 ) -> Self
sourcepub async fn handle_outbound_request(
&mut self,
request: OutboundRpcRequest,
write_reqs_tx: &mut Sender<(NetworkMessage, Sender<Result<(), PeerManagerError>>)>
) -> Result<(), RpcError>
pub async fn handle_outbound_request( &mut self, request: OutboundRpcRequest, write_reqs_tx: &mut Sender<(NetworkMessage, Sender<Result<(), PeerManagerError>>)> ) -> Result<(), RpcError>
Handle a new outbound rpc request from the application layer.
sourcepub fn next_completed_request(
&mut self
) -> impl Future<Output = (RequestId, Result<(f64, u64), RpcError>)> + FusedFuture + '_
pub fn next_completed_request( &mut self ) -> impl Future<Output = (RequestId, Result<(f64, u64), RpcError>)> + FusedFuture + '_
Method for Peer
actor to drive the pending outbound rpc tasks forward.
The returned Future
is a FusedFuture
so it works correctly in a
futures::select!
.
sourcepub fn handle_completed_request(
&mut self,
request_id: RequestId,
result: Result<(f64, u64), RpcError>
)
pub fn handle_completed_request( &mut self, request_id: RequestId, result: Result<(f64, u64), RpcError> )
Handle a newly completed task from the self.outbound_rpc_tasks
queue.
At this point, the application layer’s request has already been fulfilled;
we just need to clean up this request and update some counters.
sourcepub fn handle_inbound_response(&mut self, response: RpcResponse)
pub fn handle_inbound_response(&mut self, response: RpcResponse)
Handle a new inbound RpcResponse
message. If we have a pending request
with a matching request id in the pending_outbound_rpcs
map, this will
trigger that corresponding task to wake up and complete in
handle_completed_request
.