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: ProtocolId

The 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: Bytes

The 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

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Converts the SerializedMessage into its deserialized version of TMessage based on the ProtocolId. See: ProtocolId::from_bytes Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more