pub struct SimNetworkProvider { /* private fields */ }Expand description
Simulated networking implementation
Implementations§
Source§impl SimNetworkProvider
impl SimNetworkProvider
Sourcepub fn new(sim: WeakSimWorld) -> Self
pub fn new(sim: WeakSimWorld) -> Self
Create a new simulated network provider
Sourcepub fn sleep(&self, duration: Duration) -> SimulationResult<SleepFuture>
pub fn sleep(&self, duration: Duration) -> SimulationResult<SleepFuture>
Sleep in simulation time.
This allows workloads to introduce delays for coordination purposes. The sleep completes when the simulation processes the corresponding Wake event.
Trait Implementations§
Source§impl Clone for SimNetworkProvider
impl Clone for SimNetworkProvider
Source§fn clone(&self) -> SimNetworkProvider
fn clone(&self) -> SimNetworkProvider
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimNetworkProvider
impl Debug for SimNetworkProvider
Source§impl NetworkProvider for SimNetworkProvider
impl NetworkProvider for SimNetworkProvider
Source§fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Self::TcpStream>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Self::TcpStream>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Connect to a remote address.
When chaos is enabled, connection establishment can fail or hang forever based on the connect_failure_mode setting (FDB ref: sim2.actor.cpp:1243-1250):
- Disabled: Normal operation (no failure injection)
- AlwaysFail: Always fail with ConnectionRefused when buggified
- Probabilistic: 50% fail with error, 50% hang forever (tests timeout handling)
Source§type TcpStream = SimTcpStream
type TcpStream = SimTcpStream
The TCP stream type for this provider.
Source§type TcpListener = SimTcpListener
type TcpListener = SimTcpListener
The TCP listener type for this provider.
Auto Trait Implementations§
impl Freeze for SimNetworkProvider
impl !RefUnwindSafe for SimNetworkProvider
impl !Send for SimNetworkProvider
impl !Sync for SimNetworkProvider
impl Unpin for SimNetworkProvider
impl !UnwindSafe for SimNetworkProvider
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)