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.Object
One 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/txn
namespace. 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
Proposal
s (seeProposalRound
)
-
-
Field Summary
Fields Modifier and Type Field Description (package private) LogIndex
acceptedNewIndex
(package private) LogIndex
acceptedOldIndex
(package private) KetchLeader
leader
(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) KetchSystem
getSystem()
(package private) void
runAsync(AnyObjectId newId)
Asynchronously distribute the round's new value forrefs/txn/accepted
to all replicas.(package private) abstract void
start()
Creates a commit forrefs/txn/accepted
and callsrunAsync(AnyObjectId)
to begin execution of the round across the system.(package private) abstract void
success()
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.IOException
Creates a commit forrefs/txn/accepted
and 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.lock
to 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/accepted
to all replicas.Invoked by
start()
after new commits have been created for the log. The method passesnewId
toKetchLeader
to 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.lock
held by the caller.
-
-