Package org.eclipse.jgit.internal.ketch
Class LeaderSnapshot
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.LeaderSnapshot
-
public class LeaderSnapshot extends java.lang.ObjectA snapshot of a leader and its view of the world.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) LogIndexcommittedIndex(package private) LogIndexheadIndex(package private) booleanidle(package private) java.util.List<ReplicaSnapshot>replicas(package private) KetchLeader.Statestate(package private) longterm
-
Constructor Summary
Constructors Constructor Description LeaderSnapshot()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voiddebug(java.lang.StringBuilder s, java.lang.String name, ObjectId accepted, ObjectId committed)private static voiddebug(java.lang.StringBuilder b, ReplicaSnapshot s)LogIndexgetCommitted()Get state the leader knows is committed on a majority of participant replicasLogIndexgetHead()Get end of the leader's logjava.util.Collection<ReplicaSnapshot>getReplicas()Get unmodifiable view of configured replicas.KetchLeader.StategetState()Get current state of the leader.longgetTerm()Get term of this leaderbooleanisIdle()Whether the leader is not running a round to reach consensus, and has no rounds queued.(package private) static java.lang.Stringstr(ObjectId c)java.lang.StringtoString()
-
-
-
Field Detail
-
replicas
final java.util.List<ReplicaSnapshot> replicas
-
state
KetchLeader.State state
-
term
long term
-
headIndex
LogIndex headIndex
-
committedIndex
LogIndex committedIndex
-
idle
boolean idle
-
-
Method Detail
-
getReplicas
public java.util.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:
trueif 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
debug
private static void debug(java.lang.StringBuilder b, ReplicaSnapshot s)
-
debug
private static void debug(java.lang.StringBuilder s, java.lang.String name, ObjectId accepted, ObjectId committed)
-
str
static java.lang.String str(ObjectId c)
-
-