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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.