X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FSnapshotState.java;h=639fdee15599de2e4c30b2edf14c3e0e09709c15;hb=c9943f5bc72d4cde9356d3bd4cf73d36f4b2f754;hp=9949211c63c416d69fb6a97ba6d6ae6bc823c086;hpb=107324809285bfbb9890cba38ffa18390f8de4bd;p=controller.git 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 9949211c63..639fdee155 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,12 +8,17 @@ package org.opendaylight.controller.cluster.raft; -import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior; +import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot; +/** + * Interface for a snapshot phase state. + * + * @author Moiz Raja + * @author Thomas Pantelis + */ 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 +43,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,14 +57,15 @@ 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 * * @param sequenceNumber + * @param timeStamp */ - void commit(long sequenceNumber); + void commit(long sequenceNumber, long timeStamp); /** * Rollback the snapshot @@ -65,5 +78,5 @@ public interface SnapshotState { * @param desiredTrimIndex * @return the actual trim index */ - long trimLog(long desiredTrimIndex, RaftActorBehavior currentBehavior); + long trimLog(long desiredTrimIndex); }