pub struct FaultConfig {
pub fs: FsFaultConfig,
pub clock: ClockFaultConfig,
pub alloc: AllocFaultConfig,
pub process: ProcessFaultConfig,
pub network: NetworkFaultConfig,
pub threading: ThreadSchedulingConfig,
}Expand description
Top-level fault configuration.
let yaml = r#"
fs:
rules:
- path: "*.wal"
op: write
error: enospc
after_bytes: 4096
probability: 0.05
clock:
drift_us_per_sec: 200
jitter_us: 50
alloc:
fail_probability: 0.001
hard_limit_bytes: 67108864
process:
rules:
- command: "gcc"
fault: hang
after_us: 5000000
threading:
strategy: random
preempt_probability: 0.1
"#;Fields§
§fs: FsFaultConfigFilesystem fault rules.
clock: ClockFaultConfigClock fault configuration.
alloc: AllocFaultConfigMemory allocator fault configuration.
process: ProcessFaultConfigSubprocess fault rules.
network: NetworkFaultConfigNetwork fault rules (for local loopback interception).
threading: ThreadSchedulingConfigThread scheduling configuration (Layer 2 ptrace only).
Implementations§
Source§impl FaultConfig
impl FaultConfig
Sourcepub fn merge(base: &FaultConfig, overlay: &FaultConfig) -> FaultConfig
pub fn merge(base: &FaultConfig, overlay: &FaultConfig) -> FaultConfig
Merge two configs: overlay values take precedence over base.
Rules are concatenated (not replaced).
Sourcepub fn validate(&self) -> Vec<ConfigError>
pub fn validate(&self) -> Vec<ConfigError>
Validate the configuration, returning a list of errors.
Sourcepub fn has_faults(&self) -> bool
pub fn has_faults(&self) -> bool
Returns true if any fault injection is configured.
Trait Implementations§
Source§impl Clone for FaultConfig
impl Clone for FaultConfig
Source§fn clone(&self) -> FaultConfig
fn clone(&self) -> FaultConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FaultConfig
impl Debug for FaultConfig
Source§impl Default for FaultConfig
impl Default for FaultConfig
Source§impl<'de> Deserialize<'de> for FaultConfig
impl<'de> Deserialize<'de> for FaultConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for FaultConfig
impl PartialEq for FaultConfig
Source§impl Serialize for FaultConfig
impl Serialize for FaultConfig
impl StructuralPartialEq for FaultConfig
Auto Trait Implementations§
impl Freeze for FaultConfig
impl RefUnwindSafe for FaultConfig
impl Send for FaultConfig
impl Sync for FaultConfig
impl Unpin for FaultConfig
impl UnsafeUnpin for FaultConfig
impl UnwindSafe for FaultConfig
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