pub trait Environment: Send + Sync + Debug {
    // Required methods
    fn target_operations(&self) -> Option<u64>;
    fn timeout_seconds(&self) -> Option<u64>;
    fn actor_runners<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Vec<ActorRunner>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn reset<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn panic_hook(&self) -> Option<Box<dyn Fn() + Sync + Send + 'static>> { ... }
}
Expand description

Every stress test must implement this trait exactly once and pass it to run_test(). The test loop uses these methods to drive the stress test.

The environment is responsible for:

  • creating actors that run during the stress test
  • creating a new instance when an actor requests one
  • specifying success criteria for the test (num operations or timeout)

Required Methods§

source

fn target_operations(&self) -> Option<u64>

Returns the target number of operations to complete before exiting

source

fn timeout_seconds(&self) -> Option<u64>

Returns the number of seconds to wait before exiting

source

fn actor_runners<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Vec<ActorRunner>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the runners for all the actors

source

fn reset<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reset the environment, when an actor requests one

Provided Methods§

source

fn panic_hook(&self) -> Option<Box<dyn Fn() + Sync + Send + 'static>>

An optional hook to invoke when panicking. Can be used to dump additional state. No reference to &self is taken by the function to make it feasible to invoke this hook while a &mut exists on the Environment. Since this is invoked during panic, the function should avoid blocking on locks or other resources.

Implementors§