Trait tor_hsservice::publish::reactor::Mockable

source ·
pub(crate) trait Mockable: Clone + Send + Sync + Sized + 'static {
    type Rng: Rng + CryptoRng;
    type ClientCirc: MockableClientCirc;

    // Required methods
    fn thread_rng(&self) -> Self::Rng;
    fn get_or_launch_specific<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        netdir: &'life1 NetDir,
        kind: HsCircKind,
        target: T
    ) -> Pin<Box<dyn Future<Output = Result<Arc<Self::ClientCirc>, Error>> + Send + 'async_trait>>
       where T: CircTarget + Send + Sync + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn estimate_upload_timeout(&self) -> Duration;
}
Expand description

Mockable state for the descriptor publisher reactor.

This enables us to mock parts of the Reactor for testing purposes.

Required Associated Types§

source

type Rng: Rng + CryptoRng

The type of random number generator.

source

type ClientCirc: MockableClientCirc

The type of client circuit.

Required Methods§

source

fn thread_rng(&self) -> Self::Rng

Return a random number generator.

source

fn get_or_launch_specific<'life0, 'life1, 'async_trait, T>( &'life0 self, netdir: &'life1 NetDir, kind: HsCircKind, target: T ) -> Pin<Box<dyn Future<Output = Result<Arc<Self::ClientCirc>, Error>> + Send + 'async_trait>>
where T: CircTarget + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a circuit of the specified kind to target.

source

fn estimate_upload_timeout(&self) -> Duration

Return an estimate-based value for how long we should allow a single directory upload operation to complete.

Includes circuit construction, stream opening, upload, and waiting for a response.

Object Safety§

This trait is not object safe.

Implementors§