Package io.microraft
Enum RaftRole
- All Implemented Interfaces:
Serializable
,Comparable<RaftRole>
,java.lang.constant.Constable
The roles of Raft nodes as defined in the Raft consensus algorithm.
At any given time each Raft node is in one of roles defined here.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionWhen a follower starts a new leader election, it first turns into a candidate.Followers issue no requests on their own.A leader handles client requests, commit operations and orchestrates a Raft group.Learners issue no requests on their own. -
Method Summary
-
Enum Constant Details
-
LEADER
A leader handles client requests, commit operations and orchestrates a Raft group. -
CANDIDATE
When a follower starts a new leader election, it first turns into a candidate. A candidate becomes leader if it wins the majority votes. -
FOLLOWER
Followers issue no requests on their own. They respond to append-entries requests sent by leaders. Followers are also voting members. They respond to vote requests sent by candidates. They can also run queries ifQueryPolicy.EVENTUAL_CONSISTENCY
is used. -
LEARNER
Learners issue no requests on their own. They only respond to append-entries requests sent by leaders. Learners are non-voting members. They do not turn into candidates and do not receive vote requests from other candidates during leader election rounds. They can also run queries ifQueryPolicy.EVENTUAL_CONSISTENCY
is used.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-