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§

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.

Object Safety§

This trait is not object safe.

Implementors§