pub struct FaultContext { /* private fields */ }Expand description
Context for fault injectors — gives access to SimWorld fault injection methods.
Unlike SimContext (which workloads receive), FaultContext provides direct
access to network partitioning and other fault primitives that normal workloads
should not use.
Implementations§
Source§impl FaultContext
impl FaultContext
Sourcepub fn new(
sim: SimWorld,
all_ips: Vec<String>,
random: SimRandomProvider,
time: SimTimeProvider,
chaos_shutdown: CancellationToken,
) -> Self
pub fn new( sim: SimWorld, all_ips: Vec<String>, random: SimRandomProvider, time: SimTimeProvider, chaos_shutdown: CancellationToken, ) -> Self
Create a new fault context.
Sourcepub fn partition(&self, a: &str, b: &str) -> SimulationResult<()>
pub fn partition(&self, a: &str, b: &str) -> SimulationResult<()>
Create a bidirectional network partition between two IPs.
The partition persists until heal_partition is called.
Sourcepub fn heal_partition(&self, a: &str, b: &str) -> SimulationResult<()>
pub fn heal_partition(&self, a: &str, b: &str) -> SimulationResult<()>
Remove a network partition between two IPs.
Sourcepub fn is_partitioned(&self, a: &str, b: &str) -> SimulationResult<bool>
pub fn is_partitioned(&self, a: &str, b: &str) -> SimulationResult<bool>
Check whether two IPs are partitioned.
Sourcepub fn random(&self) -> &SimRandomProvider
pub fn random(&self) -> &SimRandomProvider
Get the seeded random provider.
Sourcepub fn time(&self) -> &SimTimeProvider
pub fn time(&self) -> &SimTimeProvider
Get the simulated time provider.
Sourcepub fn chaos_shutdown(&self) -> &CancellationToken
pub fn chaos_shutdown(&self) -> &CancellationToken
Get the chaos-phase shutdown token.
This token is cancelled at the chaos→recovery boundary, signaling fault injectors to stop.
Auto Trait Implementations§
impl Freeze for FaultContext
impl !RefUnwindSafe for FaultContext
impl !Send for FaultContext
impl !Sync for FaultContext
impl Unpin for FaultContext
impl UnsafeUnpin for FaultContext
impl !UnwindSafe for FaultContext
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