Move null check from getTotalMemory()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / SnapshotState.java
index 9a9bf1c774a49c3a87cb285a599da382ecad9931..5d1304fe752222214a82b9d877da996dc517feb4 100644 (file)
@@ -8,14 +8,11 @@
 
 package org.opendaylight.controller.cluster.raft;
 
-import akka.japi.Procedure;
-import org.opendaylight.controller.cluster.DataPersistenceProvider;
-import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
 
 public interface SnapshotState {
     /**
-     * Should return true when a snapshot is being captured
-     * @return
+     * @return true when a snapshot is being captured
      */
     boolean isCapturing();
 
@@ -41,30 +38,27 @@ public interface SnapshotState {
     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<Void> callback);
+    void apply(ApplySnapshot snapshot);
 
     /**
      * Persist the snapshot
      *
-     * @param persistenceProvider
      * @param snapshotBytes
      * @param currentBehavior
      * @param totalMemory
      */
-    void persist(DataPersistenceProvider persistenceProvider, byte[] snapshotBytes, RaftActorBehavior currentBehavior
-            ,long totalMemory);
+    void persist(byte[] snapshotBytes, 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
@@ -77,5 +71,5 @@ public interface SnapshotState {
      * @param desiredTrimIndex
      * @return the actual trim index
      */
-    long trimLog(long desiredTrimIndex, RaftActorBehavior currentBehavior);
+    long trimLog(long desiredTrimIndex);
 }