Class DefaultRaftMember
- All Implemented Interfaces:
RaftMember,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.atomix.raft.cluster.RaftMember
RaftMember.Type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTypeChangeListener(Consumer<RaftMember.Type> listener) Adds a listener to be called when the member's type changes.voidclose()demote()Demotes the member to the next lowest type.demote(RaftMember.Type type) Demotes the member to the given type.booleanReturns the time at which the member was updated.getType()Returns the member type.inthash()Returns the member hash.inthashCode()memberId()Returns the member node ID.promote()Promotes the member to the next highest type.promote(RaftMember.Type type) Promotes the member to the given type.remove()Removes the member from the configuration.toString()update(RaftMember.Type type, Instant time) Updates the member type.
-
Constructor Details
-
DefaultRaftMember
-
-
Method Details
-
memberId
Description copied from interface:RaftMemberReturns the member node ID.- Specified by:
memberIdin interfaceRaftMember- Returns:
- The member node ID.
-
hash
public int hash()Description copied from interface:RaftMemberReturns the member hash.- Specified by:
hashin interfaceRaftMember- Returns:
- The member hash.
-
addTypeChangeListener
Description copied from interface:RaftMemberAdds a listener to be called when the member's type changes.The type change callback will be called when the local server receives notification of the change in type to this member. Type changes may occur at different times from the perspective of different servers but are guaranteed to occur in the same order on all servers.
- Specified by:
addTypeChangeListenerin interfaceRaftMember- Parameters:
listener- The listener to be called when the member's type changes.
-
promote
Description copied from interface:RaftMemberPromotes the member to the next highest type.If the member is promoted to
RaftMember.Type.ACTIVEthe Raft quorum size will increase.- Specified by:
promotein interfaceRaftMember- Returns:
- A completable future to be completed once the member has been promoted.
-
promote
Description copied from interface:RaftMemberPromotes the member to the given type.If the member is promoted to
RaftMember.Type.ACTIVEthe Raft quorum size will increase.- Specified by:
promotein interfaceRaftMember- Parameters:
type- The type to which to promote the member.- Returns:
- A completable future to be completed once the member has been promoted.
-
demote
Description copied from interface:RaftMemberDemotes the member to the next lowest type.If the member is an
RaftMember.Type.ACTIVEmember then demoting it will impact the Raft quorum size.- Specified by:
demotein interfaceRaftMember- Returns:
- A completable future to be completed once the member has been demoted.
-
demote
Description copied from interface:RaftMemberDemotes the member to the given type.If the member is an
RaftMember.Type.ACTIVEmember then demoting it will impact the Raft quorum size.- Specified by:
demotein interfaceRaftMember- Parameters:
type- The type to which to demote the member.- Returns:
- A completable future to be completed once the member has been demoted.
-
remove
Description copied from interface:RaftMemberRemoves the member from the configuration.If the member is a part of the current Raft quorum (is an
RaftMember.Type.ACTIVEmember) then the quorum will be impacted by removing the member.- Specified by:
removein interfaceRaftMember- Returns:
- A completable future to be completed once the member has been removed from the configuration.
-
getLastUpdated
Description copied from interface:RaftMemberReturns the time at which the member was updated.The member update time is not guaranteed to be consistent across servers or consistent across server restarts. The update time is guaranteed to be monotonically increasing.
- Specified by:
getLastUpdatedin interfaceRaftMember- Returns:
- The time at which the member was updated.
-
getType
Description copied from interface:RaftMemberReturns the member type.The member type is indicative of the member's level of participation in the Raft consensus algorithm and asynchronous replication within the cluster. Member types may change throughout the lifetime of the cluster. Types can be changed by
promotingordemotingthe member. Member types for a given member are guaranteed to change in the same order on all nodes, but the type of a member may be different from the perspective of different nodes at any given time.- Specified by:
getTypein interfaceRaftMember- Returns:
- The member type.
-
update
Updates the member type.- Parameters:
type- The member type.- Returns:
- The member.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
hashCode
public int hashCode() -
equals
-
toString
-