Add JournalSegmentFile.map()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / SendInstallSnapshot.java
index 6c3313f316623c10fcdf7468e1181d5941044201..cdb94d44ee2914319ad9c652ccf8cde1e6e544cf 100644 (file)
@@ -5,10 +5,32 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.cluster.raft.base.messages;
 
-import java.io.Serializable;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.io.ByteSource;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.controller.cluster.raft.persisted.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 @NonNull Snapshot snapshot;
+    private final @NonNull ByteSource snapshotBytes;
+
+    public SendInstallSnapshot(@NonNull Snapshot snapshot, @NonNull ByteSource snapshotBytes) {
+        this.snapshot = requireNonNull(snapshot);
+        this.snapshotBytes = requireNonNull(snapshotBytes);
+    }
+
+    public @NonNull Snapshot getSnapshot() {
+        return snapshot;
+    }
 
-public class SendInstallSnapshot implements Serializable {
+    public @NonNull ByteSource getSnapshotBytes() {
+        return snapshotBytes;
+    }
 }