pub struct StorageState {
pub next_file_id: u64,
pub config: StorageConfiguration,
pub per_process_configs: HashMap<IpAddr, StorageConfiguration>,
pub files: BTreeMap<FileId, StorageFileState>,
pub path_to_file: BTreeMap<String, FileId>,
pub deleted_paths: HashSet<String>,
pub sync_failures: HashSet<(FileId, u64)>,
}Expand description
Storage-related state management for the simulation.
Fields§
§next_file_id: u64Counter for generating unique file IDs
config: StorageConfigurationDefault storage configuration (used when no per-process config is set)
per_process_configs: HashMap<IpAddr, StorageConfiguration>Per-process storage configurations, keyed by IP address.
When a file’s owner IP has an entry here, that config is used for fault injection and latency calculations instead of the global default.
files: BTreeMap<FileId, StorageFileState>Active files indexed by their ID
path_to_file: BTreeMap<String, FileId>Mapping from path to file ID for quick lookup
deleted_paths: HashSet<String>Set of paths that have been deleted (for create_new semantics)
sync_failures: HashSet<(FileId, u64)>Set of (file_id, op_seq) pairs for sync operations that failed
Implementations§
Source§impl StorageState
impl StorageState
Sourcepub fn new(config: StorageConfiguration) -> Self
pub fn new(config: StorageConfiguration) -> Self
Create a new storage state with the given configuration.
Sourcepub fn config_for(&self, ip: IpAddr) -> &StorageConfiguration
pub fn config_for(&self, ip: IpAddr) -> &StorageConfiguration
Resolve storage configuration for a given IP address.
Returns the per-process config if one is set, otherwise the global default.
Trait Implementations§
Source§impl Debug for StorageState
impl Debug for StorageState
Auto Trait Implementations§
impl Freeze for StorageState
impl RefUnwindSafe for StorageState
impl Send for StorageState
impl Sync for StorageState
impl Unpin for StorageState
impl UnsafeUnpin for StorageState
impl UnwindSafe for StorageState
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