Move null check from getTotalMemory()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / SnapshotState.java
index 9949211c63c416d69fb6a97ba6d6ae6bc823c086..5d1304fe752222214a82b9d877da996dc517feb4 100644 (file)
@@ -8,12 +8,11 @@
 
 package org.opendaylight.controller.cluster.raft;
 
-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();
 
@@ -38,6 +37,13 @@ public interface SnapshotState {
      */
     boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex, String targetFollower);
 
+    /**
+     * Applies a snapshot on a follower that was installed by the leader.
+     *
+     * @param snapshot the Snapshot to apply.
+     */
+    void apply(ApplySnapshot snapshot);
+
     /**
      * Persist the snapshot
      *
@@ -45,7 +51,7 @@ public interface SnapshotState {
      * @param currentBehavior
      * @param totalMemory
      */
-    void persist(byte[] snapshotBytes, RaftActorBehavior currentBehavior, long totalMemory);
+    void persist(byte[] snapshotBytes, long totalMemory);
 
     /**
      * Commit the snapshot by trimming the log
@@ -65,5 +71,5 @@ public interface SnapshotState {
      * @param desiredTrimIndex
      * @return the actual trim index
      */
-    long trimLog(long desiredTrimIndex, RaftActorBehavior currentBehavior);
+    long trimLog(long desiredTrimIndex);
 }