Skip to main content

PerfectLink

Struct PerfectLink 

Source
pub struct PerfectLink<P> { /* private fields */ }
Expand description

Reliable delivery, exactly once, over a stubborn link.

Implementations§

Source§

impl<P> PerfectLink<P>

Source

pub fn new(me: NodeId, interval: Duration) -> Self

A perfect link for process me, retransmitting every interval underneath.

Source

pub fn delivered_count(&self) -> usize

How many distinct messages have been delivered upward.

Source

pub fn outstanding(&self) -> usize

How many transmissions the layer below is still retrying.

Trait Implementations§

Source§

impl<P: Debug> Debug for PerfectLink<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Link<P> for PerfectLink<P>
where P: Clone,

The perfect link satisfies the link port, and reports no scope boundary.

Link::classify here never yields LinkInd::Boundary: PL2’s no-duplication holds within one incarnation of the recipient, and this link has no means of observing that incarnation ending. A link that reported a boundary it cannot see would be asserting something it does not know, which docs/scope-annotated-modules.md forbids by Definition 2a.

Nothing in the type system enforces that, and crate::link records why: a ScopedLink marker trait existed for exactly this and was deleted for want of a consumer — the one layer that should have bounded on it could not, because its resend lives in the Link impl and the tighter bound would have fallen on every link. What keeps it honest instead is the classification itself, and tests/link_port.rs pins both halves: that this link’s classification never yields a boundary, and that the session link’s yields one for each variant that reports it.

Source§

fn send(to: NodeId, msg: P) -> Cmd<P>

The request that sends msg to to. Read more
Source§

fn classify(_: Ind<P>) -> LinkInd<P>

What this indication means to the layer above. Read more
Source§

impl<P: Clone> Protocol for PerfectLink<P>

Source§

type Scope = Infallible

No scope conditions: this protocol’s guarantees do not lapse.

Source§

type Meta = Infallible

Keeps nothing durably: a crash loses everything this protocol knows.

Source§

type Cmd = Cmd<P>

Requests from the layer above.
Source§

type Ind = Ind<P>

Indications to the layer above — this protocol delivering on its guarantee.
Source§

type Msg = Wire<P>

What crosses the wire to a peer running the same protocol.
Source§

type Note = Note

The vocabulary in which this protocol narrates its decisions. Read more
Source§

type Entry = Infallible

The durable entries this protocol appends: what accumulates.
Source§

fn on_cmd(&mut self, _: Cmd<P>, cx: &mut ProtoCx<'_, Self>)

Handle a request from the layer above.
Source§

fn on_msg(&mut self, from: NodeId, msg: Wire<P>, cx: &mut ProtoCx<'_, Self>)

Handle a message received from from.
Source§

fn on_timer(&mut self, id: TimerId, cx: &mut ProtoCx<'_, Self>)

Handle a timer that fired somewhere in this protocol or in what it composes. Read more
§

fn on_init( &mut self, _cx: &mut Cx<'_, Self::Msg, Self::Ind, Self::Note, Self::Meta, Self::Entry>, )

Begin, on a first start — when nothing has been written down. Read more
§

fn on_recovery( &mut self, _cx: &mut Cx<'_, Self::Msg, Self::Ind, Self::Note, Self::Meta, Self::Entry>, )

Resume after a crash, reading what survived. Read more
§

fn on_scope_event( &mut self, _scope: Self::Scope, _cx: &mut Cx<'_, Self::Msg, Self::Ind, Self::Note, Self::Meta, Self::Entry>, )

Handle a boundary of a scope this protocol’s guarantees depend on — its end, or the beginning of the one that succeeds it. Read more

Auto Trait Implementations§

§

impl<P> Freeze for PerfectLink<P>

§

impl<P> RefUnwindSafe for PerfectLink<P>
where P: RefUnwindSafe,

§

impl<P> Send for PerfectLink<P>
where P: Send,

§

impl<P> Sync for PerfectLink<P>
where P: Sync,

§

impl<P> Unpin for PerfectLink<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for PerfectLink<P>

§

impl<P> UnwindSafe for PerfectLink<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<P, L> VolatileLink<P> for L
where L: Link<P, Meta = Infallible, Entry = Infallible>,