pub struct ChaosEngine { /* private fields */ }
Expand description
Chaos engine that orchestrates random failure injection
Implementations§
Source§impl ChaosEngine
impl ChaosEngine
Sourcepub fn new(config: ChaosConfig) -> Self
pub fn new(config: ChaosConfig) -> Self
Create a new chaos engine
Sourcepub async fn is_enabled(&self) -> bool
pub async fn is_enabled(&self) -> bool
Check if chaos mode is enabled
Sourcepub async fn set_enabled(&self, enabled: bool)
pub async fn set_enabled(&self, enabled: bool)
Enable or disable chaos mode
Sourcepub async fn update_config(&self, new_config: ChaosConfig)
pub async fn update_config(&self, new_config: ChaosConfig)
Update chaos configuration
Sourcepub async fn process_request(&self, _tags: &[String]) -> ChaosResult
pub async fn process_request(&self, _tags: &[String]) -> ChaosResult
Process a request with random chaos injection Returns Some((status_code, error_message)) if an error should be injected
Sourcepub async fn inject_latency(&self, tags: &[String]) -> Result<()>
pub async fn inject_latency(&self, tags: &[String]) -> Result<()>
Inject latency for a request (respects delay_rate)
Sourcepub async fn should_inject_error(&self, tags: &[String]) -> bool
pub async fn should_inject_error(&self, tags: &[String]) -> bool
Check if an error should be injected (respects error_rate)
Sourcepub async fn get_error_response(&self) -> Option<(u16, String)>
pub async fn get_error_response(&self) -> Option<(u16, String)>
Get a random error response
Sourcepub async fn get_config(&self) -> ChaosConfig
pub async fn get_config(&self) -> ChaosConfig
Get current chaos configuration
Sourcepub async fn get_statistics(&self) -> ChaosStatistics
pub async fn get_statistics(&self) -> ChaosStatistics
Get chaos statistics
Trait Implementations§
Source§impl Clone for ChaosEngine
impl Clone for ChaosEngine
Source§fn clone(&self) -> ChaosEngine
fn clone(&self) -> ChaosEngine
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 ChaosEngine
impl Debug for ChaosEngine
Auto Trait Implementations§
impl Freeze for ChaosEngine
impl !RefUnwindSafe for ChaosEngine
impl Send for ChaosEngine
impl Sync for ChaosEngine
impl Unpin for ChaosEngine
impl !UnwindSafe for ChaosEngine
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