pub type WrappedWorkload = FDBWorkload;Expand description
Rust representation of a FoundationDB workload
Aliased Type§
#[repr(C)]pub struct WrappedWorkload {
pub inner: *mut Opaque_workload,
pub setup: Option<unsafe extern "C" fn(*mut Opaque_workload, *mut FDB_database, FDBPromise)>,
pub start: Option<unsafe extern "C" fn(*mut Opaque_workload, *mut FDB_database, FDBPromise)>,
pub check: Option<unsafe extern "C" fn(*mut Opaque_workload, *mut FDB_database, FDBPromise)>,
pub getMetrics: Option<unsafe extern "C" fn(*mut Opaque_workload, FDBMetrics)>,
pub getCheckTimeout: Option<unsafe extern "C" fn(*mut Opaque_workload) -> f64>,
pub free: Option<unsafe extern "C" fn(*mut Opaque_workload)>,
}Fields§
§inner: *mut Opaque_workload§setup: Option<unsafe extern "C" fn(*mut Opaque_workload, *mut FDB_database, FDBPromise)>§start: Option<unsafe extern "C" fn(*mut Opaque_workload, *mut FDB_database, FDBPromise)>§check: Option<unsafe extern "C" fn(*mut Opaque_workload, *mut FDB_database, FDBPromise)>§getMetrics: Option<unsafe extern "C" fn(*mut Opaque_workload, FDBMetrics)>§getCheckTimeout: Option<unsafe extern "C" fn(*mut Opaque_workload) -> f64>§free: Option<unsafe extern "C" fn(*mut Opaque_workload)>Implementations§
Source§impl WrappedWorkload
impl WrappedWorkload
Sourcepub fn new<W: RustWorkload + 'static>(workload: W) -> Self
pub fn new<W: RustWorkload + 'static>(workload: W) -> Self
Examples found in repository?
examples/noop/lib.rs (line 77)
64 fn create(name: String, context: WorkloadContext) -> WrappedWorkload {
65 let client_id = context.client_id();
66 let client_count = context.client_count();
67 println!("RustWorkloadFactory::create({name})[{client_id}/{client_count}]");
68 println!(
69 "my_c_option: {:?}",
70 context.get_option::<String>("my_c_option")
71 );
72 println!(
73 "my_c_option: {:?}",
74 context.get_option::<String>("my_c_option")
75 );
76 match name.as_str() {
77 "NoopWorkload" => WrappedWorkload::new(NoopWorkload::new(name, client_id, context)),
78 _ => panic!("Unknown workload name: {name}"),
79 }
80 }