Package org.eclipse.jgit.internal.ketch
Class Round
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.Round
-
- Direct Known Subclasses:
ElectionRound,ProposalRound
abstract class Round extends java.lang.ObjectOne round-trip to all replicas proposing a log entry.In Raft a log entry represents a state transition at a specific index in the replicated log. The leader can only append log entries to the log.
In Ketch a log entry is recorded under the
refs/txnnamespace. This occurs when:- a replica wants to establish itself as a new leader by proposing a new
term (see
ElectionRound) - an established leader wants to gain consensus on new
Proposals (seeProposalRound)
-
-
Field Summary
Fields Modifier and Type Field Description (package private) LogIndexacceptedNewIndex(package private) LogIndexacceptedOldIndex(package private) KetchLeaderleader(package private) java.util.List<ReceiveCommand>stageCommands
-
Constructor Summary
Constructors Constructor Description Round(KetchLeader leader, LogIndex head)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) KetchSystemgetSystem()(package private) voidrunAsync(AnyObjectId newId)Asynchronously distribute the round's new value forrefs/txn/acceptedto all replicas.(package private) abstract voidstart()Creates a commit forrefs/txn/acceptedand callsrunAsync(AnyObjectId)to begin execution of the round across the system.(package private) abstract voidsuccess()Notify the round it was accepted by a majority of the system.
-
-
-
Field Detail
-
leader
final KetchLeader leader
-
acceptedOldIndex
final LogIndex acceptedOldIndex
-
acceptedNewIndex
LogIndex acceptedNewIndex
-
stageCommands
java.util.List<ReceiveCommand> stageCommands
-
-
Constructor Detail
-
Round
Round(KetchLeader leader, LogIndex head)
-
-
Method Detail
-
getSystem
KetchSystem getSystem()
-
start
abstract void start() throws java.io.IOExceptionCreates a commit forrefs/txn/acceptedand callsrunAsync(AnyObjectId)to begin execution of the round across the system.If references are being updated (such as in a
ProposalRound) the RefTree may be modified.Invoked without
KetchLeader.lockto build objects.- Throws:
java.io.IOException- the round cannot build new objects within the leader's repository. The leader may be unable to execute.
-
runAsync
void runAsync(AnyObjectId newId)
Asynchronously distribute the round's new value forrefs/txn/acceptedto all replicas.Invoked by
start()after new commits have been created for the log. The method passesnewIdtoKetchLeaderto be distributed to all known replicas.- Parameters:
newId- new value forrefs/txn/accepted.
-
success
abstract void success()
Notify the round it was accepted by a majority of the system.Invoked by the leader with
KetchLeader.lockheld by the caller.
-
-