public class LeaderRole extends Role
| Modifier and Type | Method and Description |
|---|---|
List<Follower> |
getFollowers()
Get this leader's known followers.
|
Timestamp |
getLeaseTimeout()
Get this leader's "lease timeout".
|
void |
stepDown()
Force this leader to step down.
|
String |
toString() |
getKVDatabasepublic List<Follower> getFollowers()
The returned list is a copy; changes have no effect on this instance.
public Timestamp getLeaseTimeout()
This is the earliest possible time at which some other, new leader could be elected in a new term. Consequently, it is the earliest possible time at which any entry that this leader is unaware of could be appended to the Raft log.
Normally, if followers are responding to AppendRequests properly, this should be a value
in the (near) future. This allows the leader to make the assumption, up until that point in time,
that its log is fully up-to-date.
Until it hears from a majority of followers, a leader will not have a lease timeout established yet. In that case this method returns null.
This method may also return null if a previous lease timeout has gotten very stale (e.g., isolated leader).
public void stepDown()
IllegalStateException - if this role is no longer active or election timer is not runningCopyright © 2016. All rights reserved.