Class Role

java.lang.Object
io.permazen.kv.raft.Role
Direct Known Subclasses:
LeaderRole, NonLeaderRole

public abstract class Role extends Object
Common superclass for the three roles played by a Raft node: leader, follower, and candidate.
  • Method Details

    • getKVDatabase

      public RaftKVDatabase getKVDatabase()
      Get the RaftKVDatabase with which this instance is associated.
      Returns:
      associated database
    • isLeaderLeaseActiveNow

      protected boolean isLeaderLeaseActiveNow()
      Determine whether the leader's lease timeout extends past the current time, that is, it is known that if the current leader is deposed by a new leader, then that deposition must occur after now.
      Returns:
      true if it is known that no other leader can possibly have been elected at the current time, otherwise false
    • isLeaderLeaseActiveAt

      protected boolean isLeaderLeaseActiveAt(Timestamp time)
      Determine whether the leader's lease timeout extends past the given time, that is, it is known that if the current leader is deposed by a new leader, then that deposition must occur after the given time.
      Parameters:
      time - leader timestamp
      Returns:
      true if it is known that no other leader can possibly have been elected at the given time, otherwise false
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object