Package io.permazen.kv.raft
Class Follower
java.lang.Object
io.permazen.kv.raft.Follower
Contains information maintained by leaders about followers.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator<Follower>
Sorts instances by their identities. -
Method Summary
Modifier and TypeMethodDescriptionGet the address of this follower.Get the identity of this follower.long
Get the leader commit index most recently sent to this follower.Get the most recent (leader's) request timestamp returned by this follower in a response, if any.long
Get the index of the highest log entry in the follower's log known to match the leader's log.long
Get the index of the next log entry to send to this follower.Get the (leader's) timestamp of the most recent snapshot install sent to this follower, if any.boolean
Determine whether this follower is currently being sent a whole database snapshot download.boolean
isSynced()
Determine whether we believe this follower is "synchronized".toString()
-
Field Details
-
SORT_BY_IDENTITY
Sorts instances by their identities.
-
-
Method Details
-
getIdentity
Get the identity of this follower.- Returns:
- follower identity
-
getAddress
Get the address of this follower.- Returns:
- follower address
-
getNextIndex
public long getNextIndex()Get the index of the next log entry to send to this follower.- Returns:
- follower next index
-
getMatchIndex
public long getMatchIndex()Get the index of the highest log entry in the follower's log known to match the leader's log.- Returns:
- follower match index; will be zero if unknown
-
getLeaderTimestamp
Get the most recent (leader's) request timestamp returned by this follower in a response, if any.- Returns:
- follower leader timestamp, or null if no response has been received yet from this follower
-
getSnapshotTimestamp
Get the (leader's) timestamp of the most recent snapshot install sent to this follower, if any.- Returns:
- follower leader timestamp, or null if no response has been received yet from this follower
-
getLeaderCommit
public long getLeaderCommit()Get the leader commit index most recently sent to this follower.- Returns:
- follower leader commit index
-
isSynced
public boolean isSynced()Determine whether we believe this follower is "synchronized".By "synchronized" we mean the most recently received
AppendResponse
indicated a successful match of the previous log entry. We only send "probes" to unsynchronized followers.- Returns:
- true if synchronized
-
isReceivingSnapshot
public boolean isReceivingSnapshot()Determine whether this follower is currently being sent a whole database snapshot download.- Returns:
- true if snapshot install is in progress
-
toString
-