Trait mixnet::request_manager::Request
source · pub trait Request {
type Context;
// Required methods
fn with_data<T>(
&self,
f: impl FnOnce(Scattered<'_, u8>) -> T,
context: &Self::Context,
) -> T;
fn num_surbs(&self, context: &Self::Context) -> usize;
fn handling_delay(
&self,
message_id: &MessageId,
context: &Self::Context,
) -> Duration;
fn handle_post_err(self, err: PostErr, context: &Self::Context);
fn handle_retry_limit_reached(self, context: &Self::Context);
}
Expand description
Requests managed by a RequestManager
must implement this trait.
Required Associated Types§
sourcetype Context
type Context
Opaque context type; a &Context
is passed through RequestManager
methods to Request
methods.
Required Methods§
sourcefn with_data<T>(
&self,
f: impl FnOnce(Scattered<'_, u8>) -> T,
context: &Self::Context,
) -> T
fn with_data<T>( &self, f: impl FnOnce(Scattered<'_, u8>) -> T, context: &Self::Context, ) -> T
Call f
with the message data. The same data must be provided every time this is called.
sourcefn num_surbs(&self, context: &Self::Context) -> usize
fn num_surbs(&self, context: &Self::Context) -> usize
Returns the number of SURBs that should be sent along with the request. The same number must be returned every time this is called.
sourcefn handling_delay(
&self,
message_id: &MessageId,
context: &Self::Context,
) -> Duration
fn handling_delay( &self, message_id: &MessageId, context: &Self::Context, ) -> Duration
Returns a conservative estimate of the handling delay. That is, the maximum time it should take for the destination mixnode to process the request and post a reply.
sourcefn handle_post_err(self, err: PostErr, context: &Self::Context)
fn handle_post_err(self, err: PostErr, context: &Self::Context)
Called if an unrecoverable error is encountered while posting to the mixnet.
sourcefn handle_retry_limit_reached(self, context: &Self::Context)
fn handle_retry_limit_reached(self, context: &Self::Context)
Called if we cannot retry posting because the configured limit has been reached.
Object Safety§
This trait is not object safe.