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§
sourcetype ClientCirc: MockableClientCirc
type ClientCirc: MockableClientCirc
The type of client circuit.
Required Methods§
sourcefn thread_rng(&self) -> Self::Rng
fn thread_rng(&self) -> Self::Rng
Return a random number generator.
sourcefn 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 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
.
sourcefn estimate_upload_timeout(&self) -> Duration
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.