Struct opendal::layers::ChaosLayer
source · pub struct ChaosLayer { /* private fields */ }
Expand description
Inject chaos into underlying services for robustness test.
Chaos
Chaos tests is a part of stress test. By generating errors at specified error ratio, we can reproduce underlying services error more reliable.
Running tests under ChaosLayer will make your application more robust.
For example: If we specify an error rate of 0.5, there is a 50% chance of an EOF error for every read operation.
Note
For now, ChaosLayer only injects read operations. More operations may be added in the future.
Examples
use anyhow::Result;
use opendal::layers::ChaosLayer;
use opendal::services;
use opendal::Operator;
use opendal::Scheme;
let _ = Operator::new(services::Memory::default())
.expect("must init")
.layer(ChaosLayer::new(0.1))
.finish();
Implementations§
Trait Implementations§
source§impl Clone for ChaosLayer
impl Clone for ChaosLayer
source§fn clone(&self) -> ChaosLayer
fn clone(&self) -> ChaosLayer
Returns a copy 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 ChaosLayer
impl Debug for ChaosLayer
source§impl<A: Accessor> Layer<A> for ChaosLayer
impl<A: Accessor> Layer<A> for ChaosLayer
§type LayeredAccessor = ChaosAccessor<A>
type LayeredAccessor = ChaosAccessor<A>
The layered accessor that return by this layer.
source§fn layer(&self, inner: A) -> Self::LayeredAccessor
fn layer(&self, inner: A) -> Self::LayeredAccessor
Intercept the operations on the underlying storage.