2 * Copyright (c) 2017 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.persisted;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.VisibleForTesting;
13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
18 * Encapsulates the snapshot State for a Shard.
20 * @author Thomas Pantelis
22 public final class ShardSnapshotState implements Snapshot.State {
24 private static final long serialVersionUID = 1L;
26 @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
27 + "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class "
28 + "aren't serialized. FindBugs does not recognize this.")
29 private final @NonNull ShardDataTreeSnapshot snapshot;
30 private final boolean migrated;
33 public ShardSnapshotState(final @NonNull ShardDataTreeSnapshot snapshot, final boolean migrated) {
34 this.snapshot = requireNonNull(snapshot);
35 this.migrated = migrated;
38 public ShardSnapshotState(final @NonNull ShardDataTreeSnapshot snapshot) {
39 this(snapshot, false);
42 public @NonNull ShardDataTreeSnapshot getSnapshot() {
47 public boolean needsMigration() {
52 private Object writeReplace() {