* 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 com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.cluster.raft.Snapshot;
+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. 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 @NonNull Snapshot snapshot;
+ private final @NonNull ByteSource snapshotBytes;
- public SendInstallSnapshot(@Nonnull Snapshot snapshot) {
- this.snapshot = Preconditions.checkNotNull(snapshot);
+ public SendInstallSnapshot(@NonNull Snapshot snapshot, @NonNull ByteSource snapshotBytes) {
+ this.snapshot = requireNonNull(snapshot);
+ this.snapshotBytes = requireNonNull(snapshotBytes);
}
- @Nonnull public Snapshot getSnapshot() {
+ public @NonNull Snapshot getSnapshot() {
return snapshot;
}
+
+ public @NonNull ByteSource getSnapshotBytes() {
+ return snapshotBytes;
+ }
}