2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import com.google.common.base.Preconditions;
11 import java.io.Serializable;
12 import java.util.List;
13 import javax.annotation.Nonnull;
14 import javax.annotation.Nullable;
17 * Stores a snapshot of the internal state of a data store.
19 * @author Thomas Pantelis
21 public class DatastoreSnapshot implements Serializable {
22 private static final long serialVersionUID = 1L;
24 private final String type;
25 private final byte[] shardManagerSnapshot;
26 private final List<ShardSnapshot> shardSnapshots;
28 public DatastoreSnapshot(@Nonnull String type, @Nullable byte[] shardManagerSnapshot,
29 @Nonnull List<ShardSnapshot> shardSnapshots) {
30 this.type = Preconditions.checkNotNull(type);
31 this.shardManagerSnapshot = shardManagerSnapshot;
32 this.shardSnapshots = Preconditions.checkNotNull(shardSnapshots);
36 public String getType() {
41 public byte[] getShardManagerSnapshot() {
42 return shardManagerSnapshot;
46 public List<ShardSnapshot> getShardSnapshots() {
47 return shardSnapshots;
50 public static class ShardSnapshot implements Serializable {
51 private static final long serialVersionUID = 1L;
53 private final String name;
54 private final byte[] snapshot;
56 public ShardSnapshot(@Nonnull String name, @Nonnull byte[] snapshot) {
57 this.name = Preconditions.checkNotNull(name);
58 this.snapshot = Preconditions.checkNotNull(snapshot);
62 public String getName() {
67 public byte[] getSnapshot() {