Skip to main content

Module workload

Module workload 

Source
Expand description

Workload trait for simulation testing.

Workloads define the distributed system behavior to test. Each workload goes through three lifecycle phases:

  1. Setup: Bind listeners, initialize state (sequential)
  2. Run: Main logic, all workloads run concurrently
  3. Check: Validate correctness after quiescence (sequential)

§Usage

use moonpool_sim::{Workload, SimContext, SimulationResult};

struct MyServer;

#[async_trait(?Send)]
impl Workload for MyServer {
    fn name(&self) -> &str { "server" }
    async fn run(&mut self, ctx: &SimContext) -> SimulationResult<()> {
        // server logic...
        Ok(())
    }
}

Traits§

Workload
A workload that participates in simulation testing.