moonpool_sim/storage/events.rs
1//! Storage operation events for simulation.
2//!
3//! These events are scheduled by SimStorageFile/SimStorageProvider and
4//! processed by SimWorld to simulate storage I/O with deterministic
5//! timing and fault injection.
6
7/// Storage operations that can be scheduled in the simulation.
8///
9/// Unlike network operations which model data delivery, storage operations
10/// model the completion of I/O requests. Each operation represents a
11/// pending I/O that completes at the scheduled time.
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub enum StorageOperation {
14 /// Read operation completed.
15 ///
16 /// The data has been read from storage and is ready to return
17 /// to the caller. Faults (if any) are applied when processing.
18 ReadComplete {
19 /// Number of bytes read
20 len: u32,
21 },
22
23 /// Write operation completed.
24 ///
25 /// The data has been accepted by the storage layer. Note that
26 /// without a sync, this data may be lost on crash.
27 WriteComplete {
28 /// Number of bytes written
29 len: u32,
30 },
31
32 /// Sync operation completed.
33 ///
34 /// All previously written data is now durable. May fail with
35 /// sync_failure_probability.
36 SyncComplete,
37
38 /// File open operation completed.
39 OpenComplete,
40
41 /// File truncate/extend operation completed.
42 SetLenComplete {
43 /// New file length
44 new_len: u64,
45 },
46}