Package io.aeron.cluster
Enum Class ElectionState
- All Implemented Interfaces:
Serializable,Comparable<ElectionState>,Constable
Election states for a
ConsensusModule which get represented by a code() stored in a
Counter of the type ConsensusModule.Configuration.ELECTION_STATE_TYPE_ID.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAwait ballot outcome from members on candidacy for leadership.Canvass members for current state and to assess if a successful leadership attempt can be mounted.Election is closed after new leader is established.Await ballot outcome after voting for a candidate.Catch-up to leader until live log can be added and merged.Await joining a replay from leader to catch-up.Initialise catch-up in preparation of receiving a replay from the leader to catch up in current term.Await joining the live log from the leader.Initialise follower in preparation for joining the live log.Replicate missing log entries from the leader.Publish append position to leader to signify ready for new term.Replay local log in preparation for following new leader.Consolidate local state and prepare for new leadership.Initialise state for new leadership term.Wait for followers to replicate any missing log entries to track commit position.Publish new leadership term and commit position, while awaiting followers ready.Replay local log in preparation for new leadership term.Nominate member for new leadership by requesting votes. -
Method Summary
Modifier and TypeMethodDescriptionintcode()Code stored in aCounterto represent the election state.static ElectionStateget(long code) Get the enum value for a given code stored in a counter.static ElectionStateget(AtomicCounter counter) Get theElectionStatevalue based on the value stored in anAtomicCounter.static ElectionStateReturns the enum constant of this class with the specified name.static ElectionState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INIT
Consolidate local state and prepare for new leadership. -
CANVASS
Canvass members for current state and to assess if a successful leadership attempt can be mounted. -
NOMINATE
Nominate member for new leadership by requesting votes. -
CANDIDATE_BALLOT
Await ballot outcome from members on candidacy for leadership. -
FOLLOWER_BALLOT
Await ballot outcome after voting for a candidate. -
LEADER_LOG_REPLICATION
Wait for followers to replicate any missing log entries to track commit position. -
LEADER_REPLAY
Replay local log in preparation for new leadership term. -
LEADER_INIT
Initialise state for new leadership term. -
LEADER_READY
Publish new leadership term and commit position, while awaiting followers ready. -
FOLLOWER_LOG_REPLICATION
Replicate missing log entries from the leader. -
FOLLOWER_REPLAY
Replay local log in preparation for following new leader. -
FOLLOWER_CATCHUP_INIT
Initialise catch-up in preparation of receiving a replay from the leader to catch up in current term. -
FOLLOWER_CATCHUP_AWAIT
Await joining a replay from leader to catch-up. -
FOLLOWER_CATCHUP
Catch-up to leader until live log can be added and merged. -
FOLLOWER_LOG_INIT
Initialise follower in preparation for joining the live log. -
FOLLOWER_LOG_AWAIT
Await joining the live log from the leader. -
FOLLOWER_READY
Publish append position to leader to signify ready for new term. -
CLOSED
Election is closed after new leader is established.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
code
public int code()Code stored in aCounterto represent the election state.- Returns:
- code stored in a
Counterto represent the election state.
-
get
Get the enum value for a given code stored in a counter.- Parameters:
code- representing election state.- Returns:
- the enum value for a given code stored in a counter.
-
get
Get theElectionStatevalue based on the value stored in anAtomicCounter.- Parameters:
counter- to read the value for matching againstcode().- Returns:
- the
ElectionStatevalue based on the value stored in anAtomicCounter.
-