pub struct FaultyTransport { /* private fields */ }Expand description
Fault-injection wrapper around InMemoryTransport.
Useful for SWIM / circuit-breaker / reconnect tests.
Implementations§
Source§impl FaultyTransport
impl FaultyTransport
Sourcepub fn new(inner: InMemoryTransport) -> Self
pub fn new(inner: InMemoryTransport) -> Self
Wrap an in-memory transport with default (healthy) fault settings.
Sourcepub fn set_drop_every_n(&self, n: u32)
pub fn set_drop_every_n(&self, n: u32)
Drop every Nth sent message (0 disables).
Sourcepub fn set_fail_next_connects(&self, n: u32)
pub fn set_fail_next_connects(&self, n: u32)
Fail the next n connect attempts with a transport error.
Sourcepub fn set_latency_ms(&self, ms: u64)
pub fn set_latency_ms(&self, ms: u64)
Artificial connect latency in milliseconds.
Sourcepub fn inner(&self) -> &InMemoryTransport
pub fn inner(&self) -> &InMemoryTransport
Access the underlying fabric (e.g. to share listeners).
Trait Implementations§
Source§impl MeshTransport for FaultyTransport
impl MeshTransport for FaultyTransport
Source§fn listen<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn TransportListener>, MeshError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn listen<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn TransportListener>, MeshError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start listening for incoming connections on the given address.
Auto Trait Implementations§
impl !Freeze for FaultyTransport
impl RefUnwindSafe for FaultyTransport
impl Send for FaultyTransport
impl Sync for FaultyTransport
impl Unpin for FaultyTransport
impl UnsafeUnpin for FaultyTransport
impl UnwindSafe for FaultyTransport
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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