Package org.eclipse.jgit.internal.ketch
Class LeaderSnapshot
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.LeaderSnapshot
-
public class LeaderSnapshot extends Object
A snapshot of a leader and its view of the world.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LogIndex
getCommitted()
Get state the leader knows is committed on a majority of participant replicasLogIndex
getHead()
Get end of the leader's logCollection<ReplicaSnapshot>
getReplicas()
Get unmodifiable view of configured replicas.KetchLeader.State
getState()
Get current state of the leader.long
getTerm()
Get term of this leaderboolean
isIdle()
Whether the leader is not running a round to reach consensus, and has no rounds queued.String
toString()
-
-
-
Method Detail
-
getReplicas
public Collection<ReplicaSnapshot> getReplicas()
Get unmodifiable view of configured replicas.- Returns:
- unmodifiable view of configured replicas.
-
getState
public KetchLeader.State getState()
Get current state of the leader.- Returns:
- current state of the leader.
-
isIdle
public boolean isIdle()
Whether the leader is not running a round to reach consensus, and has no rounds queued.- Returns:
true
if the leader is not running a round to reach consensus, and has no rounds queued.
-
getTerm
public long getTerm()
Get term of this leader- Returns:
- term of this leader. Valid only if
getState()
is currentlyKetchLeader.State.LEADER
.
-
getHead
@Nullable public LogIndex getHead()
Get end of the leader's log- Returns:
- end of the leader's log; null if leader hasn't started up enough to begin its own election.
-
getCommitted
@Nullable public LogIndex getCommitted()
Get state the leader knows is committed on a majority of participant replicas- Returns:
- state the leader knows is committed on a majority of participant replicas. Null until the leader instance has committed a log index within its own term.
-
-