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.
*/
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.
*
/**
* 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<OutputStream> installSnapshotStream, long totalMemory);
/**
* Commit the snapshot by trimming the log.