Bug 5740: Add ControlMessage interface to raft messages
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / SendInstallSnapshot.java
index 94e31846eebf1d947d483585ce19ec2b3a3f5ae7..e8d58f253afe09a27cc79c07e306c258e1b35929 100644 (file)
@@ -9,21 +9,29 @@
 package org.opendaylight.controller.cluster.raft.base.messages;
 
 import com.google.common.base.Preconditions;
+import com.google.common.io.ByteSource;
 import javax.annotation.Nonnull;
-import org.opendaylight.controller.cluster.raft.Snapshot;
+import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 /**
- * Internal message sent from the SnapshotManager to its associated leader. The leader is expected to apply the
- * {@link Snapshot} to its state.
+ * 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(@Nonnull Snapshot snapshot) {
+    public SendInstallSnapshot(@Nonnull Snapshot snapshot, @Nonnull ByteSource snapshotBytes) {
         this.snapshot = Preconditions.checkNotNull(snapshot);
+        this.snapshotBytes = Preconditions.checkNotNull(snapshotBytes);
     }
 
-    @Nonnull public Snapshot getSnapshot() {
+    @Nonnull
+    public Snapshot getSnapshot() {
         return snapshot;
     }
+
+    public ByteSource getSnapshotBytes() {
+        return snapshotBytes;
+    }
 }