Request

Trait 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§

Source

type Context

Opaque context type; a &Context is passed through RequestManager methods to Request methods.

Required Methods§

Source

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.

Source

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.

Source

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.

Source

fn handle_post_err(self, err: PostErr, context: &Self::Context)

Called if an unrecoverable error is encountered while posting to the mixnet.

Source

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.

Implementors§