Class TestOnlyRaftPolicy

  • All Implemented Interfaces:
    RaftPolicy

    public class TestOnlyRaftPolicy
    extends Object
    implements RaftPolicy
    A RaftPolicy that disables elections so that we can then specify exactly which Shard Replica should be Leader. Once a Leader is assigned it will behave as per Raft.
    • Constructor Detail

      • TestOnlyRaftPolicy

        public TestOnlyRaftPolicy()
    • Method Detail

      • automaticElectionsEnabled

        public boolean automaticElectionsEnabled()
        Description copied from interface: RaftPolicy
        According to Raft a Follower which does not receive a heartbeat (aka AppendEntries) in a given period should become a Candidate and trigger an election.
        Specified by:
        automaticElectionsEnabled in interface RaftPolicy
        Returns:
        true to enable automatic Raft elections, false to disable them
      • applyModificationToStateBeforeConsensus

        public boolean applyModificationToStateBeforeConsensus()
        Description copied from interface: RaftPolicy
        According to Raft consensus on a Raft entry is achieved only after a Leader replicates a log entry to a majority of it's followers.
        Specified by:
        applyModificationToStateBeforeConsensus in interface RaftPolicy
        Returns:
        true if modification should be applied before consensus, false to apply modification to state as per Raft