Trait tor_hsservice::ipt_mgr::Mockable
source · pub(crate) trait Mockable<R>: Debug + Send + Sync + Sized + 'static {
type IptEstablisher: Send + Sync + 'static;
type Rng<'m>: Rng + CryptoRng + 'm;
// Required methods
fn thread_rng(&mut self) -> Self::Rng<'_>;
fn make_new_ipt(
&mut self,
imm: &Immutable<R>,
params: IptParameters
) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>;
fn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static));
fn expire_old_ipts_external_persistent_state_hook(&self);
}
Expand description
Mockable state for the IPT Manager
This allows us to use a fake IPT Establisher and IPT Publisher, so that we can unit test the Manager.
Required Associated Types§
sourcetype IptEstablisher: Send + Sync + 'static
type IptEstablisher: Send + Sync + 'static
IPT establisher type
Required Methods§
sourcefn thread_rng(&mut self) -> Self::Rng<'_>
fn thread_rng(&mut self) -> Self::Rng<'_>
Return a random number generator
sourcefn make_new_ipt(
&mut self,
imm: &Immutable<R>,
params: IptParameters
) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>
fn make_new_ipt( &mut self, imm: &Immutable<R>, params: IptParameters ) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>
Call IptEstablisher::new
sourcefn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static))
fn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static))
Call IptEstablisher::start_accepting
sourcefn expire_old_ipts_external_persistent_state_hook(&self)
fn expire_old_ipts_external_persistent_state_hook(&self)
Allow tests to see when IptManager::expire_old_ipts_external_persistent_state
is called.
This lets tests see that it gets called at the right times, and not the wrong ones.
Object Safety§
This trait is not object safe.