pub struct NetworkingConfig<Tr: ?Sized, S: ?Sized, Name = ()> { /* private fields */ }Expand description
A network channel configuration with T as transport backend and S as the serialization
backend.
Implementations§
Source§impl<Tr: ?Sized, S: ?Sized> NetworkingConfig<Tr, S>
impl<Tr: ?Sized, S: ?Sized> NetworkingConfig<Tr, S>
Source§impl<Tr: ?Sized, N> NetworkingConfig<Tr, NoSer, N>
impl<Tr: ?Sized, N> NetworkingConfig<Tr, NoSer, N>
Sourcepub const fn bincode(self) -> NetworkingConfig<Tr, Bincode, N>
pub const fn bincode(self) -> NetworkingConfig<Tr, Bincode, N>
Configures the network channel to use bincode to serialize items.
Source§impl<S: ?Sized> NetworkingConfig<Tcp<()>, S>
impl<S: ?Sized> NetworkingConfig<Tcp<()>, S>
Sourcepub const fn fail_stop(self) -> NetworkingConfig<Tcp<FailStop>, S>
pub const fn fail_stop(self) -> NetworkingConfig<Tcp<FailStop>, S>
Configures the TCP transport to stop sending messages after a failed connection.
Note that the Hydro simulator will not simulate connection failures that impact the
liveness of a program. If an output assertion depends on a fail_stop channel
making progress, that channel will not experience a failure that would cause the test to
block indefinitely. However, any safety issues caused by connection failures will still
be caught, such as a race condition between a failed connection and some other message.
Sourcepub const fn lossy(self, nondet: NonDet) -> NetworkingConfig<Tcp<Lossy>, S>
pub const fn lossy(self, nondet: NonDet) -> NetworkingConfig<Tcp<Lossy>, S>
Configures the TCP transport to allow messages to be lost.
This is appropriate for networks where messages may be dropped, such as when
running under a Maelstrom partition nemesis. Unlike fail_stop, which guarantees
a prefix of messages is delivered, lossy makes no such guarantee.
§Non-Determinism
A lossy TCP channel will non-deterministically drop messages during execution.
Sourcepub const fn lossy_delayed_forever(
self,
) -> NetworkingConfig<Tcp<LossyDelayedForever>, S>
pub const fn lossy_delayed_forever( self, ) -> NetworkingConfig<Tcp<LossyDelayedForever>, S>
Configures the TCP transport to treat dropped messages as indefinitely delayed.
This is appropriate for networks where messages may be dropped, such as when
running under a Maelstrom partition nemesis. Unlike Self::lossy, this does
not require a NonDet annotation because the output is always lower in the
partial order than the ideal stream. However, the output stream will have
NoOrder guarantees, imposing stricter conditions on downstream consumers.
Unlike Self::lossy, this mode can easily be simulated in exhaustive mode
without running into fairness issues.
When using this mode in the Hydro simulator, you must call
.test_safety_only() to opt in:
the simulator will not actually drop packets—it delays “dropped” messages until
the end of the execution, which catches safety bugs but cannot test liveness.
Source§impl<O, F, S: ?Sized> NetworkingConfig<EmbeddedTransport<(), O, F>, S>
impl<O, F, S: ?Sized> NetworkingConfig<EmbeddedTransport<(), O, F>, S>
Sourcepub const fn never_duplicates(
self,
) -> NetworkingConfig<EmbeddedTransport<ExactlyOnce, O, F>, S>
pub const fn never_duplicates( self, ) -> NetworkingConfig<EmbeddedTransport<ExactlyOnce, O, F>, S>
Declares that the host’s channel never delivers a message more than once, so the received stream keeps the sent stream’s retries.
Sourcepub const fn may_duplicate(
self,
) -> NetworkingConfig<EmbeddedTransport<AtLeastOnce, O, F>, S>
pub const fn may_duplicate( self, ) -> NetworkingConfig<EmbeddedTransport<AtLeastOnce, O, F>, S>
Declares that the host’s channel may deliver a message more than once, so the received
stream is AtLeastOnce.
Source§impl<R, F, S: ?Sized> NetworkingConfig<EmbeddedTransport<R, (), F>, S>
impl<R, F, S: ?Sized> NetworkingConfig<EmbeddedTransport<R, (), F>, S>
Sourcepub const fn never_reorders(
self,
) -> NetworkingConfig<EmbeddedTransport<R, TotalOrder, F>, S>
pub const fn never_reorders( self, ) -> NetworkingConfig<EmbeddedTransport<R, TotalOrder, F>, S>
Declares that the host’s channel delivers each sender’s messages in the order it sent them, so the received stream keeps the sent stream’s order.
Sourcepub const fn may_reorder(
self,
) -> NetworkingConfig<EmbeddedTransport<R, NoOrder, F>, S>
pub const fn may_reorder( self, ) -> NetworkingConfig<EmbeddedTransport<R, NoOrder, F>, S>
Declares that the host’s channel may deliver a sender’s messages in a different order
than it sent them, so the received stream is NoOrder.
Source§impl<R, O, S: ?Sized> NetworkingConfig<EmbeddedTransport<R, O, ()>, S>
impl<R, O, S: ?Sized> NetworkingConfig<EmbeddedTransport<R, O, ()>, S>
Sourcepub const fn never_drops(
self,
) -> NetworkingConfig<EmbeddedTransport<R, O, FailStop>, S>
pub const fn never_drops( self, ) -> NetworkingConfig<EmbeddedTransport<R, O, FailStop>, S>
Declares that the host’s channel never drops a message: while it stays live, it delivers
every message sent. Like never_reorders and
never_duplicates, this holds as long as the
channel remains live; if it fails, it delivers nothing more, like
TCP.fail_stop().
Sourcepub const fn may_drop(
self,
nondet: NonDet,
) -> NetworkingConfig<EmbeddedTransport<R, O, Lossy>, S>
pub const fn may_drop( self, nondet: NonDet, ) -> NetworkingConfig<EmbeddedTransport<R, O, Lossy>, S>
Declares that the host’s channel may lose messages and keep delivering later ones, like
TCP.lossy().
§Non-Determinism
A lossy channel will non-deterministically drop messages during execution.
Sourcepub const fn may_delay_forever(
self,
) -> NetworkingConfig<EmbeddedTransport<R, O, LossyDelayedForever>, S>
pub const fn may_delay_forever( self, ) -> NetworkingConfig<EmbeddedTransport<R, O, LossyDelayedForever>, S>
Declares that the host’s channel may never deliver a message, which is treated as
indefinitely delayed, like
TCP.lossy_delayed_forever(). The received
stream is NoOrder.
The Hydro simulator requires
.test_safety_only() for this mode.
Source§impl<S: ?Sized> NetworkingConfig<Udp<()>, S>
impl<S: ?Sized> NetworkingConfig<Udp<()>, S>
Sourcepub const fn lossy(self, nondet: NonDet) -> NetworkingConfig<Udp<Lossy>, S>
pub const fn lossy(self, nondet: NonDet) -> NetworkingConfig<Udp<Lossy>, S>
Configures the UDP transport to allow messages to be lost.
UDP never guarantees delivery or ordering, so unlike TCP there is no fail_stop
policy — messages may always be dropped and the output stream always has
NoOrder guarantees.
§Non-Determinism
A lossy UDP channel will non-deterministically drop messages during execution.
Sourcepub const fn lossy_delayed_forever(
self,
) -> NetworkingConfig<Udp<LossyDelayedForever>, S>
pub const fn lossy_delayed_forever( self, ) -> NetworkingConfig<Udp<LossyDelayedForever>, S>
Configures the UDP transport to treat dropped messages as indefinitely delayed.
UDP never guarantees delivery or ordering, so unlike TCP there is no fail_stop
policy. Unlike Self::lossy, this does not require a NonDet annotation
because the output is always lower in the partial order than the ideal stream
(dropped messages are modeled as infinite delays). The output stream has
NoOrder guarantees, imposing stricter conditions on downstream consumers.
Unlike Self::lossy, this mode can easily be simulated in exhaustive mode
without running into fairness issues.
When using this mode in the Hydro simulator, you must call
.test_safety_only() to opt in:
the simulator will not actually drop packets—it delays “dropped” messages until
the end of the execution, which catches safety bugs but cannot test liveness.
Trait Implementations§
Source§impl<Tr, S, T: ?Sized> NetworkFor<T> for NetworkingConfig<Tr, S>
impl<Tr, S, T: ?Sized> NetworkFor<T> for NetworkingConfig<Tr, S>
Source§type OrderingGuarantee = <Tr as TransportKind>::OrderingGuarantee
type OrderingGuarantee = <Tr as TransportKind>::OrderingGuarantee
O, the output ordering
will be <O as MinOrder<Self::OrderingGuarantee>>::Min.Source§type RetriesGuarantee = <Tr as TransportKind>::RetriesGuarantee
type RetriesGuarantee = <Tr as TransportKind>::RetriesGuarantee
R, the output retries
will be <R as MinRetries<Self::RetriesGuarantee>>::Min.Source§type ConsistencyGuarantee = <Tr as TransportKind>::ConsistencyGuarantee
type ConsistencyGuarantee = <Tr as TransportKind>::ConsistencyGuarantee
Stream::broadcast_closed). Read moreSource§fn serialize_thunk(is_demux: bool) -> Expr
fn serialize_thunk(is_demux: bool) -> Expr
T.Source§fn deserialize_thunk(tagged: Option<&Type>) -> Expr
fn deserialize_thunk(tagged: Option<&Type>) -> Expr
T.Source§fn is_embedded() -> bool
fn is_embedded() -> bool
EMBEDDED channel). When true, Self::serialize_thunk and
Self::deserialize_thunk are never called; the raw element type flows across the
channel unserialized.Source§fn networking_info() -> NetworkingInfo
fn networking_info() -> NetworkingInfo
NetworkingInfo describing this network channel’s transport and fault model.Source§impl<Tr, S, T: ?Sized> NetworkFor<T> for NetworkingConfig<Tr, S, String>
impl<Tr, S, T: ?Sized> NetworkFor<T> for NetworkingConfig<Tr, S, String>
Source§type OrderingGuarantee = <Tr as TransportKind>::OrderingGuarantee
type OrderingGuarantee = <Tr as TransportKind>::OrderingGuarantee
O, the output ordering
will be <O as MinOrder<Self::OrderingGuarantee>>::Min.Source§type RetriesGuarantee = <Tr as TransportKind>::RetriesGuarantee
type RetriesGuarantee = <Tr as TransportKind>::RetriesGuarantee
R, the output retries
will be <R as MinRetries<Self::RetriesGuarantee>>::Min.Source§type ConsistencyGuarantee = <Tr as TransportKind>::ConsistencyGuarantee
type ConsistencyGuarantee = <Tr as TransportKind>::ConsistencyGuarantee
Stream::broadcast_closed). Read moreSource§fn serialize_thunk(is_demux: bool) -> Expr
fn serialize_thunk(is_demux: bool) -> Expr
T.Source§fn deserialize_thunk(tagged: Option<&Type>) -> Expr
fn deserialize_thunk(tagged: Option<&Type>) -> Expr
T.Source§fn is_embedded() -> bool
fn is_embedded() -> bool
EMBEDDED channel). When true, Self::serialize_thunk and
Self::deserialize_thunk are never called; the raw element type flows across the
channel unserialized.Source§fn networking_info() -> NetworkingInfo
fn networking_info() -> NetworkingInfo
NetworkingInfo describing this network channel’s transport and fault model.Auto Trait Implementations§
impl<Tr, S, Name> Freeze for NetworkingConfig<Tr, S, Name>
impl<Tr, S, Name> RefUnwindSafe for NetworkingConfig<Tr, S, Name>where
Option<Name>: RefUnwindSafe,
(PhantomData<Tr>, PhantomData<S>): RefUnwindSafe,
Tr: ?Sized,
S: ?Sized,
impl<Tr, S, Name> Send for NetworkingConfig<Tr, S, Name>
impl<Tr, S, Name> Sync for NetworkingConfig<Tr, S, Name>
impl<Tr, S, Name> Unpin for NetworkingConfig<Tr, S, Name>
impl<Tr, S, Name> UnsafeUnpin for NetworkingConfig<Tr, S, Name>where
Option<Name>: UnsafeUnpin,
(PhantomData<Tr>, PhantomData<S>): UnsafeUnpin,
Tr: ?Sized,
S: ?Sized,
impl<Tr, S, Name> UnwindSafe for NetworkingConfig<Tr, S, Name>where
Option<Name>: UnwindSafe,
(PhantomData<Tr>, PhantomData<S>): UnwindSafe,
Tr: ?Sized,
S: ?Sized,
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
§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> ⓘ
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> ⓘ
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