Skip to main content

Module context

Module context 

Source
Expand description

Simulation context for workloads.

SimContext is the single entry point for workloads to access simulation infrastructure: providers, topology, shared state, and shutdown signaling.

§Usage

use moonpool_sim::SimContext;

async fn my_workload(ctx: &SimContext) -> SimulationResult<()> {
    let server_ip = ctx.peer("server").expect("server not found");
    let stream = ctx.network().connect(&server_ip).await?;
    ctx.state().publish("connected", true);
    Ok(())
}

Structs§

SimContext
Simulation context provided to workloads.