Package io.permazen.kv.raft
Class Role
java.lang.Object
io.permazen.kv.raft.Role
- Direct Known Subclasses:
LeaderRole
,NonLeaderRole
-
Method Summary
Modifier and TypeMethodDescriptionGet theRaftKVDatabase
with which this instance is associated.protected boolean
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.protected boolean
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.abstract String
toString()
-
Method Details
-
getKVDatabase
Get theRaftKVDatabase
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
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
-