public interface RaftMember
This interface provides metadata and operations related to a specific member of a Raft cluster.
Each server in a RaftCluster has a view of the cluster state and can reference and operate on
specific members of the cluster via this API.
| Modifier and Type | Interface and Description |
|---|---|
static class |
RaftMember.Type
Indicates how the member participates in voting and replication.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTypeChangeListener(Consumer<RaftMember.Type> listener)
Adds a listener to be called when the member's type changes.
|
CompletableFuture<Void> |
demote()
Demotes the member to the next lowest type.
|
CompletableFuture<Void> |
demote(RaftMember.Type type)
Demotes the member to the given type.
|
Instant |
getLastUpdated()
Returns the time at which the member was updated.
|
RaftMember.Type |
getType()
Returns the member type.
|
int |
hash()
Returns the member hash.
|
MemberId |
memberId()
Returns the member node ID.
|
CompletableFuture<Void> |
promote()
Promotes the member to the next highest type.
|
CompletableFuture<Void> |
promote(RaftMember.Type type)
Promotes the member to the given type.
|
CompletableFuture<Void> |
remove()
Removes the member from the configuration.
|
void |
removeTypeChangeListener(Consumer<RaftMember.Type> listener)
Removes a type change listener from the member.
|
MemberId memberId()
int hash()
RaftMember.Type getType()
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 promoting or demoting the 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.
void addTypeChangeListener(Consumer<RaftMember.Type> listener)
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.
listener - The listener to be called when the member's type changes.void removeTypeChangeListener(Consumer<RaftMember.Type> listener)
listener - The listener to remove from the member.Instant getLastUpdated()
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.
CompletableFuture<Void> promote()
If the member is promoted to RaftMember.Type.ACTIVE the Raft quorum size will increase.
CompletableFuture<Void> promote(RaftMember.Type type)
If the member is promoted to RaftMember.Type.ACTIVE the Raft quorum size will increase.
type - The type to which to promote the member.CompletableFuture<Void> demote()
If the member is an RaftMember.Type.ACTIVE member then demoting it will impact the Raft quorum size.
CompletableFuture<Void> demote(RaftMember.Type type)
If the member is an RaftMember.Type.ACTIVE member then demoting it will impact the Raft quorum size.
type - The type to which to demote the member.CompletableFuture<Void> remove()
If the member is a part of the current Raft quorum (is an RaftMember.Type.ACTIVE member) then the
quorum will be impacted by removing the member.
Copyright © 2013–2017. All rights reserved.