pub struct SimStorage { /* private fields */ }Expand description
Simulated persistent storage with WAL and fault injection.
BTreeMap-backed for deterministic iteration order.
Implementations§
Source§impl SimStorage
impl SimStorage
Sourcepub fn with_disk_model(node_id: NodeId, disk_model: DiskModel) -> Self
pub fn with_disk_model(node_id: NodeId, disk_model: DiskModel) -> Self
Create with a custom disk model.
Sourcepub fn set_snapshot_failure(&mut self, fail: bool)
pub fn set_snapshot_failure(&mut self, fail: bool)
Set snapshot failure fault.
Sourcepub fn set_silent_corrupt_probability(&mut self, p: f64)
pub fn set_silent_corrupt_probability(&mut self, p: f64)
Set silent corruption probability.
Sourcepub fn set_faults(&mut self, faults: StorageFaultConfig)
pub fn set_faults(&mut self, faults: StorageFaultConfig)
Set fault configuration.
Sourcepub fn set_disk_full(&mut self, full: bool)
pub fn set_disk_full(&mut self, full: bool)
Enable disk full fault.
Sourcepub fn set_read_error(&mut self, err: bool)
pub fn set_read_error(&mut self, err: bool)
Enable read error fault.
Sourcepub fn crash_and_recover(&mut self, rng: &mut DetRng)
pub fn crash_and_recover(&mut self, rng: &mut DetRng)
Simulate a crash and restart with optional write reordering.
Sourcepub fn total_reads(&self) -> u64
pub fn total_reads(&self) -> u64
Stats: total reads.
Sourcepub fn total_writes(&self) -> u64
pub fn total_writes(&self) -> u64
Stats: total writes.
Sourcepub fn faults(&self) -> &StorageFaultConfig
pub fn faults(&self) -> &StorageFaultConfig
Get fault configuration.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SimStorage
impl !RefUnwindSafe for SimStorage
impl Send for SimStorage
impl !Sync for SimStorage
impl Unpin for SimStorage
impl UnsafeUnpin for SimStorage
impl UnwindSafe for SimStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more