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
sourceimpl Debug for InboundRpcRequest
impl Debug for InboundRpcRequest
sourceimpl SerializedRequest for InboundRpcRequest
impl SerializedRequest for InboundRpcRequest
fn protocol_id(&self) -> ProtocolId
fn data(&self) -> &Bytes
sourcefn to_message<'a, TMessage: Deserialize<'a>>(&'a self) -> Result<TMessage>
fn to_message<'a, TMessage: Deserialize<'a>>(&'a self) -> Result<TMessage>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more