Skip to main content

MultiPaxosSynod

Struct MultiPaxosSynod 

Source
pub struct MultiPaxosSynod<C: Clone, L: VolatileLink<SynodMsg<C>> = SessionLink<SynodMsg<C>>> { /* private fields */ }
Expand description

The Synod protocol: acceptor and leader in one process, as §4.4 co-locates them.

L is the link beneath, a parameter rather than a fixed type, and it defaults to SessionLink rather than to the perfect link. That is deliberate: the real-world set’s first obligation is running over a session link, and this is the first module here that can meet it before joining rather than after. A boundary is classified and propagated; this layer bridges nothing.

Implementations§

Source§

impl<C: Clone, L: VolatileLink<SynodMsg<C>>> MultiPaxosSynod<C, L>

The Synod protocol among acceptors, over a link the caller supplies.

Source

pub fn adopted_ballot(&self) -> Option<Ballot>

α.ballot_num — the ballot this process has adopted as an acceptor, or ⊥.

Source

pub fn leader_ballot(&self) -> Ballot

λ.ballot_num — the ballot this process is leading with.

Source

pub fn is_active(&self) -> bool

λ.active — whether phase one has completed for the current ballot.

Source

pub fn is_trusted(&self) -> bool

Whether Ω currently trusts this process.

Source

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

Who Ω currently trusts, if it has spoken.

Source

pub fn decided_count(&self) -> usize

The slots this leader has seen decided. Grows with slots decided, exactly as proposals does; §4.2 collects both.

Source

pub fn accepted_count(&self) -> usize

How many pvalues this acceptor holds — after §4.1, the number of slots it has accepted for, not the number of ⟨ballot, slot⟩ pairs. Grows with the slots handled, which is the measurement docs/bounded-space.md wants for a transcription.

Source

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

The slots this leader currently has a commander for.

Source

pub fn accepted_for(&self, slot: Slot) -> Option<(Ballot, &C)>

The pvalue this acceptor holds for slot, if any — after §4.1, at most one, carrying the highest ballot it has accepted for that slot.

Source

pub fn collected_below(&self) -> Slot

The slot below which this process has discarded its state — §4.2’s watermark, as it has been acted on. Only ever rises.

Source

pub fn reports_held(&self) -> usize

How many members have said how far they have applied. Bounded by membership; the measurement docs/bounded-space.md wants beside the two that are now bounded.

Source

pub fn is_scouting(&self) -> bool

Whether a scout is running phase one.

Source§

impl<C: Clone> MultiPaxosSynod<C, SessionLink<SynodMsg<C>>>

Source

pub fn new( me: NodeId, acceptors: impl IntoIterator<Item = NodeId>, timing: Timing, ) -> Self

The Synod protocol among acceptors, over the session link this module defaults to.

Trait Implementations§

Source§

impl<C: Debug + Clone, L: Debug + VolatileLink<SynodMsg<C>>> Debug for MultiPaxosSynod<C, L>

Source§

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

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

impl<C, L> Protocol for MultiPaxosSynod<C, L>
where C: Clone, L: VolatileLink<SynodMsg<C>>,

Source§

type Scope = <L as Protocol>::Scope

Whatever the link’s guarantees are conditional on. This layer adds no condition of its own and bridges none of the link’s.

Source§

type Meta = Infallible

Keeps nothing durably, which is what makes this crash-stop. §4.3 is the change that alters it, and the module documentation says what a durable ballot counter would buy.

Source§

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

A request from the layer above carries no sender, which is what distinguishes it from a forwarded one: only a proposal that has not travelled may be forwarded.

Source§

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

An expiry is offered to every layer, so both children are given it and this layer acts only on the handle it registered.

Source§

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

⟨ Init ⟩ — start the detector, whose first Trust may immediately make this process scout, and arm the sweep.

Source§

fn on_scope_event(&mut self, scope: L::Scope, cx: &mut ProtoCx<'_, Self>)

Hand the boundary down to the link, which is the layer that knows what it means. Leaving this to the trait’s default would take a scope event the driver raised and drop it — the cardinal sin of docs/conditional-guarantees.md.

Source§

type Cmd = Cmd<C>

Requests from the layer above.
Source§

type Ind = Ind<C>

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

type Msg = Wire<<L 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_msg(&mut self, from: NodeId, msg: Self::Msg, cx: &mut ProtoCx<'_, Self>)

Handle a message received from from.
§

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

Auto Trait Implementations§

§

impl<C, L> Freeze for MultiPaxosSynod<C, L>
where L: Freeze,

§

impl<C, L> RefUnwindSafe for MultiPaxosSynod<C, L>
where L: RefUnwindSafe, <L as Protocol>::Ind: RefUnwindSafe, C: RefUnwindSafe,

§

impl<C, L> Send for MultiPaxosSynod<C, L>
where L: Send, C: Send, <L as Protocol>::Ind: Send,

§

impl<C, L> Sync for MultiPaxosSynod<C, L>
where L: Sync, C: Sync, <L as Protocol>::Ind: Sync,

§

impl<C, L> Unpin for MultiPaxosSynod<C, L>
where L: Unpin, <L as Protocol>::Ind: Unpin,

§

impl<C, L> UnsafeUnpin for MultiPaxosSynod<C, L>
where L: UnsafeUnpin,

§

impl<C, L> UnwindSafe for MultiPaxosSynod<C, L>
where C: RefUnwindSafe, L: UnwindSafe, <L 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