pub struct OpFault {
pub kind: FaultKind,
pub fail_per_thousand: u32,
pub latency: Duration,
}Expand description
What one operation class does under fault injection.
Fields§
§kind: FaultKindThe error a failing call produces.
fail_per_thousand: u32How many calls out of every thousand fail. 0 never fails, 1000
always does, and the calls that fail are the same ones on every run:
call n fails when (n + 1) * rate / 1000 exceeds n * rate / 1000.
latency: DurationHow long every call to this operation sleeps before it is answered or failed. This is the stall: the call still completes, eventually, which is exactly what makes an unbounded caller hang on it.
Implementations§
Source§impl OpFault
impl OpFault
Sourcepub const fn rate(kind: FaultKind, per_thousand: u32) -> Self
pub const fn rate(kind: FaultKind, per_thousand: u32) -> Self
Fail per_thousand calls out of every thousand with kind.
Sourcepub const fn stall(latency: Duration) -> Self
pub const fn stall(latency: Duration) -> Self
Answer every call correctly, latency late. A store that is merely
slow, which is the fault no error counter ever sees.
Sourcepub const fn with_latency(self, latency: Duration) -> Self
pub const fn with_latency(self, latency: Duration) -> Self
The same fault, latency late.
Trait Implementations§
impl Copy for OpFault
impl Eq for OpFault
impl StructuralPartialEq for OpFault
Auto Trait Implementations§
impl Freeze for OpFault
impl RefUnwindSafe for OpFault
impl Send for OpFault
impl Sync for OpFault
impl Unpin for OpFault
impl UnsafeUnpin for OpFault
impl UnwindSafe for OpFault
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more