Merge "Fix ReplicationAndSnapshotsIntegrationTest failure"
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / SnapshotState.java
index 2ff30ec53b24fd6c3664e23a591d574c93878fe7..9949211c63c416d69fb6a97ba6d6ae6bc823c086 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.controller.cluster.raft;
 
-import akka.japi.Procedure;
-import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
 
 public interface SnapshotState {
@@ -24,40 +22,37 @@ 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
-     */
-    void captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex);
-
-    /**
-     * Create the snapshot
+     * @param targetFollower
      *
-     * @param callback a procedure to be called which should create the snapshot
+     * @return true if capture was started
      */
-    void create(Procedure<Void> callback);
+    boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex, String targetFollower);
 
     /**
      * 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);
 
     /**
      * Rollback the snapshot
@@ -70,5 +65,5 @@ public interface SnapshotState {
      * @param desiredTrimIndex
      * @return the actual trim index
      */
-    long trimLog(long desiredTrimIndex);
+    long trimLog(long desiredTrimIndex, RaftActorBehavior currentBehavior);
 }