pub trait RustWorkload {
// Required methods
async fn setup(&mut self, db: SimDatabase);
async fn start(&mut self, db: SimDatabase);
async fn check(&mut self, db: SimDatabase);
fn get_metrics(&self, out: Metrics);
fn get_check_timeout(&self) -> f64;
}Expand description
Equivalent to the C++ abstract class FDBWorkload
Required Methods§
Sourceasync fn setup(&mut self, db: SimDatabase)
async fn setup(&mut self, db: SimDatabase)
This method is called by the tester during the setup phase. It should be used to populate the database.
§Arguments
db- The simulated database.
Sourceasync fn start(&mut self, db: SimDatabase)
async fn start(&mut self, db: SimDatabase)
Sourceasync fn check(&mut self, db: SimDatabase)
async fn check(&mut self, db: SimDatabase)
This method is called when the tester completes. A workload should run any consistency/correctness tests during this phase.
§Arguments
db- The simulated database.
Sourcefn get_metrics(&self, out: Metrics)
fn get_metrics(&self, out: Metrics)
If a workload collects metrics (like latencies or throughput numbers), these should be reported back here. The multitester (or test orchestrator) will collect all metrics from all test clients and it will aggregate them.
§Arguments
out- A metric sink
Sourcefn get_check_timeout(&self) -> f64
fn get_check_timeout(&self) -> f64
Set the check timeout in simulated seconds for this workload.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.