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=acb6e01230ecd64b8b6625f3f1c54eae227bd629;hp=e423737706bc0d42055d388bb72b7f4a7890256b;hb=73ab61a037dd2489600acbc1eaf6f9ee549c204a;hpb=b0f8283587b5cc8573d29f66219cbe7f70e21e1b 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 e423737706..acb6e01230 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,7 +8,10 @@ package org.opendaylight.controller.cluster.raft; +import java.io.OutputStream; +import java.util.Optional; import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot; +import org.opendaylight.controller.cluster.raft.persisted.Snapshot; /** * Interface for a snapshot phase state. @@ -43,6 +46,14 @@ public interface SnapshotState { */ boolean captureToInstall(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex, String targetFollower); + /** + * Initiates a capture snapshot, while enforcing trimming of the log up to lastAppliedIndex. + * @param lastLogEntry the last entry in the replicated log + * @param replicatedToAllIndex the current replicatedToAllIndex + * @return true if capture was started + */ + boolean captureWithForcedTrim(ReplicatedLogEntry lastLogEntry, long replicatedToAllIndex); + /** * Applies a snapshot on a follower that was installed by the leader. * @@ -53,10 +64,12 @@ public interface SnapshotState { /** * Persists a snapshot. * - * @param snapshotBytes the snapshot bytes + * @param snapshotState the snapshot State + * @param installSnapshotStream Optional OutputStream that is present if the snapshot is to also be installed + * on a follower. * @param totalMemory the total memory threshold */ - void persist(byte[] snapshotBytes, long totalMemory); + void persist(Snapshot.State snapshotState, Optional installSnapshotStream, long totalMemory); /** * Commit the snapshot by trimming the log.