pub struct FailureConfig {
pub enabled: bool,
pub failure_rate: f64,
pub failure_types: Vec<FailureType>,
pub schedule: FailureSchedule,
pub cascade_probability: f64,
pub recovery_time: Duration,
pub max_concurrent_failures: usize,
pub seed: Option<u64>,
}Expand description
Failure injection configuration.
Fields§
§enabled: boolWhether failure injection is enabled.
failure_rate: f64Failure injection rate (0.0 - 1.0).
failure_types: Vec<FailureType>Types of failures to inject.
schedule: FailureScheduleFailure schedule type.
cascade_probability: f64Probability of cascading failures.
recovery_time: DurationTime to recover from a failure.
max_concurrent_failures: usizeMaximum concurrent failures allowed.
seed: Option<u64>Random seed for reproducibility.
Implementations§
Source§impl FailureConfig
impl FailureConfig
Sourcepub fn with_types(self, types: Vec<FailureType>) -> Self
pub fn with_types(self, types: Vec<FailureType>) -> Self
Set failure types.
Sourcepub fn with_schedule(self, schedule: FailureSchedule) -> Self
pub fn with_schedule(self, schedule: FailureSchedule) -> Self
Set schedule.
Sourcepub fn should_inject(&self) -> bool
pub fn should_inject(&self) -> bool
Check if a failure should be injected.
Sourcepub fn next_failure_type(&self) -> FailureType
pub fn next_failure_type(&self) -> FailureType
Get the next failure type to inject.
Trait Implementations§
Source§impl Clone for FailureConfig
impl Clone for FailureConfig
Source§fn clone(&self) -> FailureConfig
fn clone(&self) -> FailureConfig
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 FailureConfig
impl Debug for FailureConfig
Source§impl Default for FailureConfig
impl Default for FailureConfig
Source§impl<'de> Deserialize<'de> for FailureConfig
impl<'de> Deserialize<'de> for FailureConfig
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
Auto Trait Implementations§
impl Freeze for FailureConfig
impl RefUnwindSafe for FailureConfig
impl Send for FailureConfig
impl Sync for FailureConfig
impl Unpin for FailureConfig
impl UnsafeUnpin for FailureConfig
impl UnwindSafe for FailureConfig
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