X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FSnapshotState.java;h=f5a175f3891de08defa6a0a7cefccf816fbf8213;hp=2ff30ec53b24fd6c3664e23a591d574c93878fe7;hb=3fda1a923defdbf18849c6080c3aa19f1ebf2c5f;hpb=9fe7a995204bcfed3ee6b644922b8fe440fe5f5c diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotState.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotState.java index 2ff30ec53b..f5a175f389 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotState.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotState.java @@ -8,14 +8,12 @@ package org.opendaylight.controller.cluster.raft; -import akka.japi.Procedure; -import org.opendaylight.controller.cluster.DataPersistenceProvider; +import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot; import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior; public interface SnapshotState { /** - * Should return true when a snapshot is being captured - * @return + * @return true when a snapshot is being captured */ boolean isCapturing(); @@ -24,40 +22,44 @@ public interface SnapshotState { * * @param lastLogEntry the last entry in the replicated log * @param replicatedToAllIndex the current replicatedToAllIndex + * + * @return true if capture was started */ - void capture(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex); + boolean capture(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex); /** * Initiate capture snapshot for the purposing of installing that snapshot * * @param lastLogEntry * @param replicatedToAllIndex + * @param targetFollower + * + * @return true if capture was started */ - void captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex); + boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex, String targetFollower); /** - * Create the snapshot + * Applies a snapshot on a follower that was installed by the leader. * - * @param callback a procedure to be called which should create the snapshot + * @param snapshot the Snapshot to apply. */ - void create(Procedure callback); + void apply(ApplySnapshot snapshot); /** * Persist the snapshot * - * @param persistenceProvider * @param snapshotBytes * @param currentBehavior + * @param totalMemory */ - void persist(DataPersistenceProvider persistenceProvider, byte[] snapshotBytes, RaftActorBehavior currentBehavior); + void persist(byte[] snapshotBytes, RaftActorBehavior currentBehavior, long totalMemory); /** * Commit the snapshot by trimming the log * - * @param persistenceProvider * @param sequenceNumber */ - void commit(DataPersistenceProvider persistenceProvider, long sequenceNumber); + void commit(long sequenceNumber, RaftActorBehavior currentBehavior); /** * Rollback the snapshot @@ -70,5 +72,5 @@ public interface SnapshotState { * @param desiredTrimIndex * @return the actual trim index */ - long trimLog(long desiredTrimIndex); + long trimLog(long desiredTrimIndex, RaftActorBehavior currentBehavior); }