Skip to main content

LoggedLink

Struct LoggedLink 

Source
pub struct LoggedLink<P: Clone + Ord> { /* private fields */ }
Expand description

Perfect-link guarantees over log-delivery, so that they hold across a restart.

Implementations§

Source§

impl<P: Clone + Ord> LoggedLink<P>

Source

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

Log-deliver for me, retransmitting every retransmit.

Source

pub fn log(&self) -> &Log<P>

What has been log-delivered. The same value the layer above is handed.

Trait Implementations§

Source§

impl<P: Debug + Clone + Ord> Debug for LoggedLink<P>

Source§

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

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

impl<P: Clone + Ord> Protocol for LoggedLink<P>

Source§

type Meta = u64

The send counter: one small value, rewritten before each send. See the module note.

Source§

type Entry = (MsgId, P)

One log-delivered message; appended, so the write cost is linear rather than quadratic.

Source§

fn on_init(&mut self, cx: &mut ProtoCx<'_, Self>)

⟨ lpl, Init ⟩ do delivered := ∅; store(delivered).

The initial write is what makes the branch real: after it, storage holds something, so every later restart takes the recovery path rather than starting afresh. What is written is the send counter at zero — the empty set is the empty sequence of entries, which needs no write of its own.

Source§

fn on_recovery(&mut self, cx: &mut ProtoCx<'_, Self>)

upon event ⟨ lpl, Recovery ⟩ do retrieve(delivered); trigger ⟨ lpl, Deliver | delivered ⟩.

The record is read here rather than handed over, along with the send counter that keys it. Nothing else is dispatched until this returns, which is what makes it safe to have held an empty index a moment ago.

The layer above is told again: the notification sent before the crash may have been lost with the incarnation that sent it.

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 Scope = Infallible

Scopes whose boundaries this protocol’s guarantees depend on, and which it can observe. Read more
Source§

type Note = Note

The vocabulary in which this protocol narrates its decisions. Read more
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_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 LoggedLink<P>

§

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

§

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

§

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

§

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

§

impl<P> UnsafeUnpin for LoggedLink<P>

§

impl<P> UnwindSafe for LoggedLink<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