Trait paxakos::voting::Voter [−][src]
pub trait Voter: Send + 'static {
type State: State;
type RoundNum: RoundNum;
type CoordNum: CoordNum;
type Yea: Debug + Send + Sync;
type Nay: Debug + Send + Sync;
type Abstain: Debug + Send + Sync;
fn contemplate_candidate(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
candidate: Option<&NodeOf<Self::State>>,
state: Option<&Self::State>
) -> Decision<(), Infallible, Self::Abstain>;
fn contemplate_proposal(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
log_entry: &LogEntryOf<Self::State>,
leader: Option<&NodeOf<Self::State>>,
state: Option<&Self::State>
) -> Decision<Self::Yea, Self::Nay, Infallible>;
fn observe_commit(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
log_entry: &LogEntryOf<Self::State>,
leader: Option<&NodeOf<Self::State>>
) { ... }
}
Expand description
Strategy to vote on candidates and proposals.
Associated Types
Required methods
Contemplate a bid for leadership.
candidate
will be None
if the node cannot be inferred due to missing
or outdated state.
Careful: state
is the current applied state and independent of
round_num
.
fn contemplate_proposal(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
log_entry: &LogEntryOf<Self::State>,
leader: Option<&NodeOf<Self::State>>,
state: Option<&Self::State>
) -> Decision<Self::Yea, Self::Nay, Infallible>
fn contemplate_proposal(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
log_entry: &LogEntryOf<Self::State>,
leader: Option<&NodeOf<Self::State>>,
state: Option<&Self::State>
) -> Decision<Self::Yea, Self::Nay, Infallible>
Contemplate a proposed log entry.
leader
will be None
if the node cannot be inferred due to missing
or outdated state.
Careful: state
is the current applied state and independent of
round_num
.
Provided methods
fn observe_commit(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
log_entry: &LogEntryOf<Self::State>,
leader: Option<&NodeOf<Self::State>>
)
fn observe_commit(
&mut self,
round_num: Self::RoundNum,
coord_num: Self::CoordNum,
log_entry: &LogEntryOf<Self::State>,
leader: Option<&NodeOf<Self::State>>
)
Called for every commit.
leader
will be None
if the node cannot be inferred due to missing
or outdated state.