X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FPrimaryShardInfo.java;h=27d247512ca0b37349e0686955d449fc0dcd1dbd;hp=bbeb1aa84bbe728ffe073e9a3cc5402161fde676;hb=50a2f5eb1c94650bc1be1e49d3a5382a1a74a9b3;hpb=107324809285bfbb9890cba38ffa18390f8de4bd diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java index bbeb1aa84b..27d247512c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java @@ -8,8 +8,8 @@ package org.opendaylight.controller.cluster.datastore.messages; import akka.actor.ActorSelection; -import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import java.util.Optional; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; @@ -20,13 +20,22 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; */ public class PrimaryShardInfo { private final ActorSelection primaryShardActor; - private final Optional localShardDataTree; + private final short primaryShardVersion; + private final DataTree localShardDataTree; - public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, @Nonnull Optional localShardDataTree) { + public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, short primaryShardVersion, + @Nonnull DataTree localShardDataTree) { this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor); + this.primaryShardVersion = primaryShardVersion; this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree); } + public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, short primaryShardVersion) { + this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor); + this.primaryShardVersion = primaryShardVersion; + this.localShardDataTree = null; + } + /** * Returns an ActorSelection representing the primary shard actor. */ @@ -34,11 +43,18 @@ public class PrimaryShardInfo { return primaryShardActor; } + /** + * Returns the version of the primary shard. + */ + public short getPrimaryShardVersion() { + return primaryShardVersion; + } + /** * Returns an Optional whose value contains the primary shard's DataTree if the primary shard is local * to the caller. Otherwise the Optional value is absent. */ public @Nonnull Optional getLocalShardDataTree() { - return localShardDataTree; + return Optional.ofNullable(localShardDataTree); } }