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 akka.actor.ActorSelection;
11 import com.google.common.base.Optional;
12 import com.google.common.base.Preconditions;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
17 * Local message DTO that contains information about the primary shard.
19 * @author Thomas Pantelis
21 public class PrimaryShardInfo {
22 private final ActorSelection primaryShardActor;
23 private final Optional<DataTree> localShardDataTree;
25 public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, @Nonnull Optional<DataTree> localShardDataTree) {
26 this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor);
27 this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree);
31 * Returns an ActorSelection representing the primary shard actor.
33 public @Nonnull ActorSelection getPrimaryShardActor() {
34 return primaryShardActor;
38 * Returns an Optional whose value contains the primary shard's DataTree if the primary shard is local
39 * to the caller. Otherwise the Optional value is absent.
41 public @Nonnull Optional<DataTree> getLocalShardDataTree() {
42 return localShardDataTree;