Struct network::protocols::rpc::InboundRpcRequest [−][src]
pub struct InboundRpcRequest {
pub protocol_id: ProtocolId,
pub data: Bytes,
pub res_tx: Sender<Result<Bytes, RpcError>>,
}Expand description
A wrapper struct for an inbound rpc request and its associated context.
Fields
protocol_id: ProtocolIdThe ProtocolId for which of our upstream application modules should
handle (i.e., deserialize and then respond to) this inbound rpc request.
For example, if protocol_id == ProtocolId::ConsensusRpcBcs, then this
inbound rpc request will be dispatched to consensus for handling.
data: BytesThe serialized request data received from the sender. At this layer in the stack, the request data is just an opaque blob and will only be fully deserialized later in the handling application module.
res_tx: Sender<Result<Bytes, RpcError>>Channel over which the rpc response is sent from the upper application layer to the network rpc layer.
The rpc actor holds onto the receiving end of this channel, awaiting the
response from the upper layer. If there is an error in, e.g.,
deserializing the request, the upper layer should send an RpcError
down the channel to signify that there was an error while handling this
rpc request. Currently, we just log these errors and drop the request.
The upper client layer should be prepared for res_tx to be disconnected
when trying to send their response, as the rpc call might have timed out
while handling the request.
Trait Implementations
Converts the SerializedMessage into its deserialized version of TMessage based on the
ProtocolId. See: ProtocolId::from_bytes Read more
Auto Trait Implementations
impl !RefUnwindSafe for InboundRpcRequest
impl Send for InboundRpcRequest
impl Sync for InboundRpcRequest
impl Unpin for InboundRpcRequest
impl !UnwindSafe for InboundRpcRequest
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = T
Should always be Self