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 / CaptureSnapshotReply.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.raft.base.messages;
9
10 import akka.dispatch.ControlMessage;
11 import com.google.common.base.Preconditions;
12 import java.io.OutputStream;
13 import java.util.Optional;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
16
17 public class CaptureSnapshotReply implements ControlMessage {
18     private final Snapshot.State snapshotState;
19     private final Optional<OutputStream> installSnapshotStream;
20
21     public CaptureSnapshotReply(@Nonnull final Snapshot.State snapshotState,
22             @Nonnull final Optional<OutputStream> installSnapshotStream) {
23         this.snapshotState = Preconditions.checkNotNull(snapshotState);
24         this.installSnapshotStream = Preconditions.checkNotNull(installSnapshotStream);
25     }
26
27     @Nonnull
28     public Snapshot.State getSnapshotState() {
29         return snapshotState;
30     }
31
32     @Nonnull
33     public Optional<OutputStream> getInstallSnapshotStream() {
34         return installSnapshotStream;
35     }
36 }