Skip to main content

RustWorkload

Trait RustWorkload 

Source
pub trait RustWorkload: Sized + 'static {
    const VT: FDBWorkload_VT = _;

    // 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;

    // Provided method
    fn wrap(self) -> WrappedWorkload { ... }
}
Expand description

Equivalent to the C++ abstract class FDBWorkload

Provided Associated Constants§

Source

const VT: FDBWorkload_VT = _

Virtual Table used by the C API

Required Methods§

Source

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.
Source

async fn start(&mut self, db: SimDatabase)

This method should run the actual test.

§Arguments
  • db - The simulated database.
Source

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.
Source

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
Source

fn get_check_timeout(&self) -> f64

Set the check timeout in simulated seconds for this workload.

Provided Methods§

Source

fn wrap(self) -> WrappedWorkload

Wrap the underlying Rust type so it can be passed to the C API

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§