pub struct RpcRequestPacketTx {
pub pow_content_hash: Hash,
pub bytes: Bytes,
}Expand description
An outbound RPC request, freshly encoded and ready to be sent over a [crate::transport::TransportFactory].
The “Tx” (transmit) side owns the encode path. Constructing one is expensive: in addition
to compressing the payload and prefixing the header, encode performs a proof-of-work
search against the destination server’s identity via ParallelPowGenerator. The pow
sits in the wire header so the server can reject under-powered requests cheaply before
doing any payload work. pow_content_hash is retained on the struct so the caller can
later verify that the response was produced for this specific request (see
[RpcResponsePacketRx]).
This type and its “Rx” counterpart RpcRequestPacketRx are intentionally separate so
the encode side and the decode side cannot be accidentally mixed up.
Fields§
§pow_content_hash: Hash§bytes: BytesImplementations§
Source§impl RpcRequestPacketTx
impl RpcRequestPacketTx
pub async fn encode( time_provider: &dyn TimeProvider, pow_minimum_per_rpc: Pow, flags: RpcRequestPacketTxFlags, payload_request_kind: PayloadRequestKind, pow_sponsor_id: &Id, destination_verification_key_bytes: &VerificationKeyBytes, destination_pq_commitment_bytes: &PQCommitmentBytes, payload_uncompressed: Bytes, pow_generator: &dyn ParallelPowGenerator, ) -> Result<Self>
Auto Trait Implementations§
impl !Freeze for RpcRequestPacketTx
impl RefUnwindSafe for RpcRequestPacketTx
impl Send for RpcRequestPacketTx
impl Sync for RpcRequestPacketTx
impl Unpin for RpcRequestPacketTx
impl UnsafeUnpin for RpcRequestPacketTx
impl UnwindSafe for RpcRequestPacketTx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more