Package org.eclipse.jgit.internal.ketch
Class LeaderSnapshot
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.LeaderSnapshot
-
public class LeaderSnapshot extends java.lang.Object
A snapshot of a leader and its view of the world.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) LogIndex
committedIndex
(package private) LogIndex
headIndex
(package private) boolean
idle
(package private) java.util.List<ReplicaSnapshot>
replicas
(package private) KetchLeader.State
state
(package private) long
term
-
Constructor Summary
Constructors Constructor Description LeaderSnapshot()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
debug(java.lang.StringBuilder s, java.lang.String name, ObjectId accepted, ObjectId committed)
private static void
debug(java.lang.StringBuilder b, ReplicaSnapshot s)
LogIndex
getCommitted()
Get state the leader knows is committed on a majority of participant replicasLogIndex
getHead()
Get end of the leader's logjava.util.Collection<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.(package private) static java.lang.String
str(ObjectId c)
java.lang.String
toString()
-
-
-
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:
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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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)
-
-