pub struct LeaderDrivenConsensus<V: Clone> { /* private fields */ }Expand description
Paxos: uniform consensus over an epoch-change and a sequence of abortable epoch consensuses.
Implementations§
Source§impl<V: Clone> LeaderDrivenConsensus<V>
impl<V: Clone> LeaderDrivenConsensus<V>
Sourcepub fn new(
me: NodeId,
peers: impl IntoIterator<Item = NodeId>,
timing: Timing,
) -> Self
pub fn new( me: NodeId, peers: impl IntoIterator<Item = NodeId>, timing: Timing, ) -> Self
Paxos among peers.
Sourcepub fn has_decided(&self) -> bool
pub fn has_decided(&self) -> bool
Whether this process has reported a decision.
Sourcepub fn state(&self) -> &State<V>
pub fn state(&self) -> &State<V>
(valts, val) as the epoch now live holds it.
This is what the abort handshake carries forward: the state a new instance is constructed from is the state the aborted one returned, so a value accepted in an early epoch is still here after several leadership changes.
Trait Implementations§
Source§impl<V: Clone> Protocol for LeaderDrivenConsensus<V>
impl<V: Clone> Protocol for LeaderDrivenConsensus<V>
Source§type Meta = Infallible
type Meta = Infallible
Keeps nothing durably. logged_leader_driven_consensus is the variant that does.
Source§fn on_cmd(&mut self, Cmd::Propose: Cmd<V>, cx: &mut ProtoCx<'_, Self>)
fn on_cmd(&mut self, Cmd::Propose: Cmd<V>, cx: &mut ProtoCx<'_, Self>)
upon event ⟨ uc, Propose | v ⟩ do val := v.
Source§type Msg = Wire<<EpochChange as Protocol>::Msg, Wire<Tagged<V>>>
type Msg = Wire<<EpochChange as Protocol>::Msg, Wire<Tagged<V>>>
What crosses the wire to a peer running the same protocol.
Source§type Scope = Infallible
type Scope = Infallible
Scopes whose boundaries this protocol’s guarantees depend on, and which it can observe. Read more
Source§type Entry = Infallible
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>)
fn on_msg(&mut self, from: NodeId, msg: Self::Msg, cx: &mut ProtoCx<'_, Self>)
Handle a message received from
from.Source§fn on_timer(&mut self, id: TimerId, cx: &mut ProtoCx<'_, Self>)
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
Source§fn on_init(&mut self, cx: &mut ProtoCx<'_, Self>)
fn on_init(&mut self, cx: &mut ProtoCx<'_, Self>)
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>,
)
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>,
)
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<V> Freeze for LeaderDrivenConsensus<V>where
V: Freeze,
impl<V> RefUnwindSafe for LeaderDrivenConsensus<V>where
V: RefUnwindSafe,
impl<V> Send for LeaderDrivenConsensus<V>where
V: Send,
impl<V> Sync for LeaderDrivenConsensus<V>where
V: Sync,
impl<V> Unpin for LeaderDrivenConsensus<V>where
V: Unpin,
impl<V> UnsafeUnpin for LeaderDrivenConsensus<V>where
V: UnsafeUnpin,
impl<V> UnwindSafe for LeaderDrivenConsensus<V>where
V: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more