pub struct ChaosEventStore<S> { /* private fields */ }Expand description
An EventStore wrapper that injects probabilistic failures and conflicts.
ChaosEventStore forwards reads and appends to the wrapped store, but first
rolls against the probabilities in its ChaosConfig: it may return a
StoreFailure on either operation, or a VersionConflict on appends. Because
it implements EventStore, it can be passed anywhere a backend is expected,
including eventcore::execute().
Prefer constructing one via ChaosEventStoreExt::with_chaos rather than
calling ChaosEventStore::new directly.
Implementations§
Source§impl<S> ChaosEventStore<S>
impl<S> ChaosEventStore<S>
Sourcepub fn new(store: S, config: ChaosConfig) -> Self
pub fn new(store: S, config: ChaosConfig) -> Self
Wraps store with chaos injection driven by config.
If the config carries a deterministic seed, the internal RNG is seeded
from it for reproducible failures; otherwise a random seed is used.
Most callers should use ChaosEventStoreExt::with_chaos instead.