pub struct Network<E: RNetwork + Spawner + Rng + Clock + Metrics, P: PublicKey> { /* private fields */ }Expand description
Implementation of a simulated network.
Implementations§
Source§impl<E: RNetwork + Spawner + Rng + Clock + Metrics, P: PublicKey> Network<E, P>
impl<E: RNetwork + Spawner + Rng + Clock + Metrics, P: PublicKey> Network<E, P>
Sourcepub fn new(context: E, cfg: Config) -> (Self, Oracle<P, E>)
pub fn new(context: E, cfg: Config) -> (Self, Oracle<P, E>)
Create a new simulated network with a given runtime and configuration.
Returns a tuple containing the network instance and the oracle that can be used to modify the state of the network during context.
Sourcepub async fn new_with_peers<I>(
context: E,
cfg: Config,
peers: I,
) -> (Self, Oracle<P, E>)where
I: IntoIterator<Item = P>,
pub async fn new_with_peers<I>(
context: E,
cfg: Config,
peers: I,
) -> (Self, Oracle<P, E>)where
I: IntoIterator<Item = P>,
Create a new simulated network with an initial primary peer set.
This is a convenience for test setups that would otherwise call
crate::Manager::track immediately after construction.
Sourcepub async fn new_with_split_peers<I, J>(
context: E,
cfg: Config,
primary: I,
secondary: J,
) -> (Self, Oracle<P, E>)where
I: IntoIterator<Item = P>,
J: IntoIterator<Item = P>,
pub async fn new_with_split_peers<I, J>(
context: E,
cfg: Config,
primary: I,
secondary: J,
) -> (Self, Oracle<P, E>)where
I: IntoIterator<Item = P>,
J: IntoIterator<Item = P>,
Create a new simulated network with primary and secondary peers split into two sets.
Peers are tracked at peer set ID 0 as TrackedPeers, matching the most common test
setup.
Auto Trait Implementations§
impl<E, P> Freeze for Network<E, P>where
E: Freeze,
impl<E, P> !RefUnwindSafe for Network<E, P>
impl<E, P> Send for Network<E, P>
impl<E, P> Sync for Network<E, P>
impl<E, P> Unpin for Network<E, P>
impl<E, P> UnsafeUnpin for Network<E, P>where
E: UnsafeUnpin,
impl<E, P> !UnwindSafe for Network<E, P>
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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