package org.opendaylight.controller.cluster.raft.base.messages;
-import com.google.protobuf.ByteString;
+import com.google.common.base.Preconditions;
+import com.google.common.io.ByteSource;
+import javax.annotation.Nonnull;
+import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
-public class SendInstallSnapshot {
- private ByteString snapshot;
+/**
+ * Internal message sent from the SnapshotManager to its associated leader when a snapshot capture is complete to
+ * prompt the leader to install the snapshot on its followers as needed.
+ */
+public final class SendInstallSnapshot {
+ private final Snapshot snapshot;
+ private final ByteSource snapshotBytes;
- public SendInstallSnapshot(ByteString snapshot) {
- this.snapshot = snapshot;
+ public SendInstallSnapshot(@Nonnull Snapshot snapshot, @Nonnull ByteSource snapshotBytes) {
+ this.snapshot = Preconditions.checkNotNull(snapshot);
+ this.snapshotBytes = Preconditions.checkNotNull(snapshotBytes);
}
- public ByteString getSnapshot() {
+ @Nonnull
+ public Snapshot getSnapshot() {
return snapshot;
}
+
+ public ByteSource getSnapshotBytes() {
+ return snapshotBytes;
+ }
}