Class 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 Proposals (see ProposalRound)
    • Method Detail

      • start

        abstract void start()
                     throws java.io.IOException
        Creates a commit for refs/txn/accepted and calls runAsync(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 for refs/txn/accepted to all replicas.

        Invoked by start() after new commits have been created for the log. The method passes newId to KetchLeader to be distributed to all known replicas.

        Parameters:
        newId - new value for refs/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.