pub struct SimulatedNetwork { /* private fields */ }Expand description
Deterministic fault-injecting network model.
Implementations§
Source§impl SimulatedNetwork
impl SimulatedNetwork
Sourcepub const fn new(fault: FaultConfig) -> Self
pub const fn new(fault: FaultConfig) -> Self
Create a new network with fault injection.
Sourcepub const fn fault_config(&self) -> FaultConfig
pub const fn fault_config(&self) -> FaultConfig
Return configured fault options.
Sourcepub fn set_partitioned(&mut self, agent: AgentId, isolated: bool)
pub fn set_partitioned(&mut self, agent: AgentId, isolated: bool)
Isolate or reconnect an agent from the network.
Sourcepub fn is_partitioned(&self, agent: AgentId) -> bool
pub fn is_partitioned(&self, agent: AgentId) -> bool
Test whether an agent is currently partitioned.
Sourcepub const fn pending_len(&self) -> usize
pub const fn pending_len(&self) -> usize
Number of queued in-flight messages.
Sourcepub fn send(
&mut self,
message: NetworkMessage,
round: u64,
rng: &mut DeterministicRng,
) -> SendOutcome
pub fn send( &mut self, message: NetworkMessage, round: u64, rng: &mut DeterministicRng, ) -> SendOutcome
Send a message with fault injection.
Sourcepub fn deliver_ready(
&mut self,
round: u64,
rng: &mut DeterministicRng,
) -> DeliverOutcome
pub fn deliver_ready( &mut self, round: u64, rng: &mut DeterministicRng, ) -> DeliverOutcome
Deliver all messages whose delivery round has arrived.
Trait Implementations§
Source§impl Clone for SimulatedNetwork
impl Clone for SimulatedNetwork
Source§fn clone(&self) -> SimulatedNetwork
fn clone(&self) -> SimulatedNetwork
Returns a duplicate 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 SimulatedNetwork
impl Debug for SimulatedNetwork
Source§impl PartialEq for SimulatedNetwork
impl PartialEq for SimulatedNetwork
impl Eq for SimulatedNetwork
impl StructuralPartialEq for SimulatedNetwork
Auto Trait Implementations§
impl Freeze for SimulatedNetwork
impl RefUnwindSafe for SimulatedNetwork
impl Send for SimulatedNetwork
impl Sync for SimulatedNetwork
impl Unpin for SimulatedNetwork
impl UnsafeUnpin for SimulatedNetwork
impl UnwindSafe for SimulatedNetwork
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