Interface RaftMember

All Known Implementing Classes:
DefaultRaftMember

public interface RaftMember
Represents a member of a Raft cluster.

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.

  • Method Details

    • memberId

      MemberId memberId()
      Returns the member node ID.
      Returns:
      The member node ID.
    • hash

      int hash()
      Returns the member hash.
      Returns:
      The member hash.
    • addTypeChangeListener

      void addTypeChangeListener(Consumer<RaftMember.Type> listener)
      Adds 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.

      Parameters:
      listener - The listener to be called when the member's type changes.
    • promote

      Promotes the member to the next highest type.

      If the member is promoted to RaftMember.Type.ACTIVE the Raft quorum size will increase.

      Returns:
      A completable future to be completed once the member has been promoted.
    • promote

      Promotes the member to the given type.

      If the member is promoted to RaftMember.Type.ACTIVE the Raft quorum size will increase.

      Parameters:
      type - The type to which to promote the member.
      Returns:
      A completable future to be completed once the member has been promoted.
    • demote

      Demotes the member to the next lowest type.

      If the member is an RaftMember.Type.ACTIVE member then demoting it will impact the Raft quorum size.

      Returns:
      A completable future to be completed once the member has been demoted.
    • demote

      Demotes the member to the given type.

      If the member is an RaftMember.Type.ACTIVE member then demoting it will impact the Raft quorum size.

      Parameters:
      type - The type to which to demote the member.
      Returns:
      A completable future to be completed once the member has been demoted.
    • remove

      Removes the member from the configuration.

      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.

      Returns:
      A completable future to be completed once the member has been removed from the configuration.
    • getLastUpdated

      Instant getLastUpdated()
      Returns 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.

      Returns:
      The time at which the member was updated.
    • getType

      RaftMember.Type getType()
      Returns 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 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.

      Returns:
      The member type.