Search in sources :

Example 21 with UpdateElectionTerm

use of org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm in project controller by opendaylight.

the class ElectionTermImpl method updateAndPersist.

@Override
public void updateAndPersist(long newTerm, String newVotedFor) {
    update(newTerm, newVotedFor);
    // FIXME : Maybe first persist then update the state
    persistence.persist(new UpdateElectionTerm(this.currentTerm, this.votedFor), NoopProcedure.instance());
}
Also used : UpdateElectionTerm(org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm)

Aggregations

UpdateElectionTerm (org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm)21 Test (org.junit.Test)17 SimpleReplicatedLogEntry (org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry)15 ApplyJournalEntries (org.opendaylight.controller.cluster.raft.persisted.ApplyJournalEntries)8 DisableElectionsRaftPolicy (org.opendaylight.controller.cluster.raft.policy.DisableElectionsRaftPolicy)8 ApplySnapshot (org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot)7 ServerConfigurationPayload (org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload)7 ServerInfo (org.opendaylight.controller.cluster.raft.persisted.ServerInfo)7 ActorRef (akka.actor.ActorRef)6 TestActorRef (akka.testkit.TestActorRef)6 ByteString (com.google.protobuf.ByteString)6 AppendEntries (org.opendaylight.controller.cluster.raft.messages.AppendEntries)6 Snapshot (org.opendaylight.controller.cluster.raft.persisted.Snapshot)6 FiniteDuration (scala.concurrent.duration.FiniteDuration)6 TestKit (akka.testkit.javadsl.TestKit)5 InstallSnapshot (org.opendaylight.controller.cluster.raft.messages.InstallSnapshot)5 ChangeServersVotingStatus (org.opendaylight.controller.cluster.raft.messages.ChangeServersVotingStatus)4 ServerChangeReply (org.opendaylight.controller.cluster.raft.messages.ServerChangeReply)4 Optional (com.google.common.base.Optional)3 ByteSource (com.google.common.io.ByteSource)3