Skip to main content

EventualLeaderDetector

Struct EventualLeaderDetector 

Source
pub struct EventualLeaderDetector<D: VolatileDetector = EventuallyPerfectFailureDetector> { /* private fields */ }
Expand description

Trust the highest-ranked process not currently suspected.

Implementations§

Source§

impl EventualLeaderDetector<EventuallyPerfectFailureDetector>

Source

pub fn new( me: NodeId, peers: impl IntoIterator<Item = NodeId>, heartbeat: Duration, detect_after: Duration, ) -> Self

Ω among peers, over the eventually perfect detector Algorithm 2.8 names.

detect_after is the silence a peer is allowed to begin with: ◇P adapts it, and will suspect correct processes while it is below what the network actually needs — which is a fault this module faithfully passes on, and which the suites above deliberately provoke.

Source§

impl<D: VolatileDetector> EventualLeaderDetector<D>

Source

pub fn with_detector( me: NodeId, peers: impl IntoIterator<Item = NodeId>, build: impl FnOnce(NodeId, BTreeSet<NodeId>) -> D, ) -> Self

Ω among peers, over whatever detector build supplies.

Source

pub fn leader(&self) -> Option<NodeId>

Who this process currently trusts, if anyone.

Source

pub fn suspected(&self) -> impl Iterator<Item = NodeId> + '_

The processes currently suspected by the detector beneath, as this layer has recorded them.

Source§

impl EventualLeaderDetector<PerfectFailureDetector>

Source

pub fn over_perfect_detection( me: NodeId, peers: impl IntoIterator<Item = NodeId>, heartbeat: Duration, detect_after: Duration, ) -> Self

Ω over a perfect failure detector beating every heartbeat and accusing after detect_after of silence.

Trait Implementations§

Source§

impl<D: Debug + VolatileDetector> Debug for EventualLeaderDetector<D>

Source§

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

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

impl<D: VolatileDetector> Protocol for EventualLeaderDetector<D>

Source§

type Scope = Infallible

No scope conditions of its own.

Source§

type Meta = Infallible

Keeps nothing durably: a restarted process suspects nobody and trusts afresh.

Source§

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

upon event ⟨ Ω, Init ⟩ — and immediately a first Trust, since with nobody suspected maxrank(Π) is already defined and the standing condition already holds.

Source§

type Cmd = Infallible

Requests from the layer above.
Source§

type Ind = Ind

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

type Msg = <D as Protocol>::Msg

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: Cmd, _: &mut ProtoCx<'_, Self>)

Handle a request from the layer above.
Source§

fn on_msg(&mut self, from: NodeId, msg: D::Msg, 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_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<D> Freeze for EventualLeaderDetector<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for EventualLeaderDetector<D>
where D: RefUnwindSafe, <D as Protocol>::Ind: RefUnwindSafe,

§

impl<D> Send for EventualLeaderDetector<D>
where D: Send, <D as Protocol>::Ind: Send,

§

impl<D> Sync for EventualLeaderDetector<D>
where D: Sync, <D as Protocol>::Ind: Sync,

§

impl<D> Unpin for EventualLeaderDetector<D>
where D: Unpin, <D as Protocol>::Ind: Unpin,

§

impl<D> UnsafeUnpin for EventualLeaderDetector<D>
where D: UnsafeUnpin,

§

impl<D> UnwindSafe for EventualLeaderDetector<D>
where D: UnwindSafe, <D as Protocol>::Ind: UnwindSafe,

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