f3521deb3b2b8ef89bf70ef3e4ea2e63a77ac8a0
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / client / messages / GetSnapshotReply.java
1 /*
2  * Copyright (c) 2015 Brocade Communications 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.client.messages;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12
13 /**
14  * Reply to GetSnapshot that returns a serialized Snapshot instance.
15  *
16  * @author Thomas Pantelis
17  */
18 public class GetSnapshotReply {
19     private final String id;
20     private final byte[] snapshot;
21
22     public GetSnapshotReply(@Nonnull String id, @Nonnull byte[] snapshot) {
23         this.id = Preconditions.checkNotNull(id);
24         this.snapshot = Preconditions.checkNotNull(snapshot);
25     }
26
27     @Nonnull
28     public String getId() {
29         return id;
30     }
31
32     @Nonnull
33     public byte[] getSnapshot() {
34         return snapshot;
35     }
36
37     @Override
38     public String toString() {
39         return "GetSnapshotReply [id=" + id + ", snapshot.length=" + snapshot.length + "]";
40     }
41 }