Package io.microraft
Enum RaftNodeStatus
- java.lang.Object
-
- java.lang.Enum<RaftNodeStatus>
-
- io.microraft.RaftNodeStatus
-
- All Implemented Interfaces:
Serializable
,Comparable<RaftNodeStatus>
public enum RaftNodeStatus extends Enum<RaftNodeStatus>
Statuses of a Raft node during its own and its Raft group's lifecycle.- See Also:
RaftNode
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ACTIVE
A Raft node stays in this status when there is no ongoing membership change or a Raft group termination process.INITIAL
Initial status of a Raft node.TERMINATED
A Raft node moves to this status either when it is removed from the Raft group member list, or it is being terminated on its own, for instance, because its JVM is shutting down.UPDATING_RAFT_GROUP_MEMBER_LIST
A Raft node moves to this status when a Raft group membership change operation is appended to its Raft log and stays in this status until the membership change is either committed or reverted.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isTerminal(RaftNodeStatus status)
Returns true if the given Raft node status is a terminal.static RaftNodeStatus
valueOf(String name)
Returns the enum constant of this type with the specified name.static RaftNodeStatus[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INITIAL
public static final RaftNodeStatus INITIAL
Initial status of a Raft node. It stays in this status until it is started.
-
ACTIVE
public static final RaftNodeStatus ACTIVE
A Raft node stays in this status when there is no ongoing membership change or a Raft group termination process. Operations are committed in this status.
-
UPDATING_RAFT_GROUP_MEMBER_LIST
public static final RaftNodeStatus UPDATING_RAFT_GROUP_MEMBER_LIST
A Raft node moves to this status when a Raft group membership change operation is appended to its Raft log and stays in this status until the membership change is either committed or reverted. New operations can be replicated while there is an ongoing membership change in the Raft group, but no other membership change, or leadership transfer can be triggered until the ongoing membership change process is completed.
-
TERMINATED
public static final RaftNodeStatus TERMINATED
A Raft node moves to this status either when it is removed from the Raft group member list, or it is being terminated on its own, for instance, because its JVM is shutting down.A Raft node stops running the Raft consensus algorithm in this status.
-
-
Method Detail
-
values
public static RaftNodeStatus[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RaftNodeStatus c : RaftNodeStatus.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RaftNodeStatus valueOf(String name)
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
-
isTerminal
public static boolean isTerminal(RaftNodeStatus status)
Returns true if the given Raft node status is a terminal. A Raft node stops running the Raft consensus algorithm in a terminal status.- Parameters:
status
- the status object to check- Returns:
- true if the given status is terminal, false otherwise
-
-