Skip to main content

MultiPaxosReplica

Struct MultiPaxosReplica 

Source
pub struct MultiPaxosReplica<V: Clone + Ord, L: VolatileLink<Carried<V>> = SessionLink<Carried<V>>> { /* private fields */ }
Expand description

A totally ordered log, built on Multi-Paxos: one consensus per slot, under a stable leader that keeps phase one across all of them.

Implementations§

Source§

impl<V: Clone + Ord> MultiPaxosReplica<V>

Source

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

A replica among peers, over the session link the Synod protocol defaults to.

The re-proposal threshold is derived rather than passed: it must exceed the time a decision legitimately takes, whose worst case is a leadership change — detect_after for Ω to move, then phase one, then phase two. detect_after * 3 clears that with room, and it is far below what filling a WINDOW of eight slots would take.

Source

pub fn with_window(self, window: Slot) -> Self

The window, for a test that needs to fill one without driving a hundred slots.

Source

pub fn with_repropose_after(self, after: Duration) -> Self

The re-proposal threshold, for a test that needs to reach it inside a settle window.

Source

pub fn with_retain(self, retain: Slot) -> Self

The retention window, for a test that needs to fill one without deciding sixty-four slots.

Source§

impl<V: Clone + Ord, L: VolatileLink<Carried<V>>> MultiPaxosReplica<V, L>

Source

pub fn entries(&self) -> impl Iterator<Item = &V>

The ordered sequence as this process holds it.

Source

pub fn len(&self) -> usize

How many commands this process has applied — the next [Position], as a count.

Source

pub fn is_empty(&self) -> bool

Source

pub fn slot_out(&self) -> Slot

slot_out: the next slot to apply. Diverges from MultiPaxosReplica::len by exactly the number of commands decided in more than one slot.

Source

pub fn slot_in(&self) -> Slot

slot_in: the next slot to propose for. R5 keeps it below slot_out + WINDOW.

Source

pub fn waiting(&self) -> usize

How many appends are waiting for a slot.

Source

pub fn outstanding(&self) -> usize

How many slots this replica has proposed for and not yet applied.

Source

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

The slots this replica has proposed for and not yet applied. R5’s substantive form is asserted over these — see the module’s note on where the page’s < reads as ≤.

Source

pub fn decisions_held(&self) -> usize

How many decisions this replica holds. Grows with commands handled, and is never collected — the measurement docs/bounded-space.md wants of a transcription.

Source

pub fn decision(&self, slot: Slot) -> Option<&Command<V>>

The command decided for slot, if this replica has heard.

Source

pub fn reported_slot_out(&self) -> Slot

How far this replica has told the consensus beneath it that it has applied.

Source

pub fn synod(&self) -> &Synod<V, L>

The Synod protocol beneath, for a test that asks who leads.

Trait Implementations§

Source§

impl<V: Debug + Clone + Ord, L: Debug + VolatileLink<Carried<V>>> Debug for MultiPaxosReplica<V, L>

Source§

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

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

impl<V: Clone + Ord, L: VolatileLink<Carried<V>>> Protocol for MultiPaxosReplica<V, L>

Source§

type Msg = <MultiPaxosSynod<Command<V>, L> as Protocol>::Msg

The child’s. This layer adds no per-hop state, so it adds no wire field.

Source§

type Scope = <MultiPaxosSynod<Command<V>, L> as Protocol>::Scope

Whatever the link beneath the child is conditional on. This layer bridges none of it.

Source§

type Meta = Infallible

Keeps nothing durably, which is what makes the crash-stop boundary in the module documentation the one that applies. §4.3 is the change that alters it.

Source§

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

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

Source§

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

⟨ Init ⟩ — arm the sweep, and start the child, whose own on_init starts the leader detector. A protocol is owed exactly one of on_init and on_recovery before its first event, and the detector beneath is the one that has gone without twice.

Source§

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

Hand the boundary to the child, which knows what it means. Leaving it to the trait’s default would take a scope event the driver raised and drop it.

Source§

type Cmd = Cmd<V>

Requests from the layer above.
Source§

type Ind = Ind<V>

Indications to the layer above — this protocol delivering on its guarantee.
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<V>, cx: &mut ProtoCx<'_, Self>)

Handle a request from the layer above.
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
Source§

impl<V: Clone + Ord, L: VolatileLink<Carried<V>>> TotalOrderLog<V> for MultiPaxosReplica<V, L>

Source§

fn append(value: V) -> Cmd<V>

The request that appends value to the log. Read more
Source§

fn read(from: Position) -> Cmd<V>

The request that reads the ordered sequence from from onwards. Read more
Source§

fn classify(ind: Ind<V>) -> LogInd<V>

What this indication means to the layer above. Read more

Auto Trait Implementations§

§

impl<V, L> Freeze for MultiPaxosReplica<V, L>
where L: Freeze,

§

impl<V, L> RefUnwindSafe for MultiPaxosReplica<V, L>
where L: RefUnwindSafe, V: RefUnwindSafe, <L as Protocol>::Ind: RefUnwindSafe,

§

impl<V, L> Send for MultiPaxosReplica<V, L>
where L: Send, V: Send, <L as Protocol>::Ind: Send,

§

impl<V, L> Sync for MultiPaxosReplica<V, L>
where L: Sync, V: Sync, <L as Protocol>::Ind: Sync,

§

impl<V, L> Unpin for MultiPaxosReplica<V, L>
where L: Unpin, V: Unpin, <L as Protocol>::Ind: Unpin,

§

impl<V, L> UnsafeUnpin for MultiPaxosReplica<V, L>
where L: UnsafeUnpin,

§

impl<V, L> UnwindSafe for MultiPaxosReplica<V, L>
where V: RefUnwindSafe + UnwindSafe, 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