pub trait Workload: 'static {
// Required methods
fn name(&self) -> &str;
fn run<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn setup<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn check<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
A workload that participates in simulation testing.
Workloads are the primary unit of distributed system behavior. The simulation
framework calls lifecycle methods in order: setup → run → check.
Required Methods§
Sourcefn run<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run phase: main workload logic.
All workloads run concurrently. Ends on completion or shutdown signal.
Provided Methods§
Sourcefn setup<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn setup<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Setup phase: bind listeners, initialize state.
All workloads complete setup before any run() starts.
Default implementation is a no-op.
Sourcefn check<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 SimContext,
) -> Pin<Box<dyn Future<Output = SimulationResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check phase: validate correctness after quiescence.
Called after all runs complete and pending events drain. Default implementation is a no-op.