Change DistributedShardedDOMDataTree's ctor signature 73/55073/4
authorJakub Morvay <jmorvay@cisco.com>
Wed, 12 Apr 2017 14:12:29 +0000 (16:12 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Tue, 18 Apr 2017 11:13:18 +0000 (11:13 +0000)
We should inject DistributedShardedDOMDataTree with AbstractDataStore
instead of DistributedDataStore, so we can allow different
implementations of distributed DOM store

Change-Id: I11d1b49e1413dcc233350a3c853b283df176bffa
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
(cherry picked from commit be3bc49185f935ad2672b08e031f602eca594d1e)

opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardChangePublisher.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontend.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/ShardedDataTreeActor.java

index 5e49c0069ed4aa266588006f4e0bad882329906e..8ff08e1615b922e4fc3a54839cf66c826144fab2 100644 (file)
@@ -22,7 +22,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
-import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
+import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
@@ -53,7 +53,7 @@ public class DistributedShardChangePublisher
 
     private static final Logger LOG = LoggerFactory.getLogger(DistributedShardChangePublisher.class);
 
-    private final DistributedDataStore distributedDataStore;
+    private final AbstractDataStore distributedDataStore;
     private final YangInstanceIdentifier shardPath;
 
     // This will be useful for signaling back pressure
@@ -65,7 +65,7 @@ public class DistributedShardChangePublisher
     private final DataTree dataTree;
 
     public DistributedShardChangePublisher(final DataStoreClient client,
-                                           final DistributedDataStore distributedDataStore,
+                                           final AbstractDataStore distributedDataStore,
                                            final DOMDataTreeIdentifier prefix,
                                            final Map<DOMDataTreeIdentifier, ChildShardContext> childShards) {
         this.client = client;
index b148b918b8ce95d006ae3cc0c36ce1b5da520c56..fb55b3a299def2cacc5a259bda690290ac270a5e 100644 (file)
@@ -17,7 +17,7 @@ import java.util.Map;
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
-import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
+import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeShard;
@@ -48,7 +48,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard {
 
     private final DistributedShardChangePublisher publisher;
 
-    DistributedShardFrontend(final DistributedDataStore distributedDataStore,
+    DistributedShardFrontend(final AbstractDataStore distributedDataStore,
                              final DataStoreClient client,
                              final DOMDataTreeIdentifier shardRoot) {
         this.client = Preconditions.checkNotNull(client);
index df49e33cdd09d74f295c6922af03974081edb5c5..506498ce9a77fecbf9d7911296aafb49c1160f11 100644 (file)
@@ -48,7 +48,7 @@ import org.opendaylight.controller.cluster.ActorSystemProvider;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
 import org.opendaylight.controller.cluster.databroker.actors.dds.SimpleDataStoreClientActor;
-import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
+import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
 import org.opendaylight.controller.cluster.datastore.Shard;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
@@ -112,8 +112,8 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
 
     private final ShardedDOMDataTree shardedDOMDataTree;
     private final ActorSystem actorSystem;
-    private final DistributedDataStore distributedOperDatastore;
-    private final DistributedDataStore distributedConfigDatastore;
+    private final AbstractDataStore distributedOperDatastore;
+    private final AbstractDataStore distributedConfigDatastore;
 
     private final ActorRef shardedDataTreeActor;
     private final MemberName memberName;
@@ -134,8 +134,8 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
     private final PrefixedShardConfigUpdateHandler updateHandler;
 
     public DistributedShardedDOMDataTree(final ActorSystemProvider actorSystemProvider,
-                                         final DistributedDataStore distributedOperDatastore,
-                                         final DistributedDataStore distributedConfigDatastore) {
+                                         final AbstractDataStore distributedOperDatastore,
+                                         final AbstractDataStore distributedConfigDatastore) {
         this.actorSystem = Preconditions.checkNotNull(actorSystemProvider).getActorSystem();
         this.distributedOperDatastore = Preconditions.checkNotNull(distributedOperDatastore);
         this.distributedConfigDatastore = Preconditions.checkNotNull(distributedConfigDatastore);
@@ -161,7 +161,7 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         createPrefixConfigShard(distributedOperDatastore);
     }
 
-    private void createPrefixConfigShard(final DistributedDataStore dataStore) {
+    private void createPrefixConfigShard(final AbstractDataStore dataStore) {
         Configuration configuration = dataStore.getActorContext().getConfiguration();
         Collection<MemberName> memberNames = configuration.getUniqueMemberNamesForAllShards();
         CreateShard createShardMessage =
@@ -398,7 +398,7 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
     private void createShardFrontend(final DOMDataTreeIdentifier prefix) {
         LOG.debug("Member {}: Creating CDS shard for prefix: {}", memberName, prefix);
         final String shardName = ClusterUtils.getCleanShardName(prefix.getRootIdentifier());
-        final DistributedDataStore distributedDataStore =
+        final AbstractDataStore distributedDataStore =
                 prefix.getDatastoreType().equals(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION)
                         ? distributedConfigDatastore : distributedOperDatastore;
 
index cfbb526e9ca5f28a590625defb9615cde29d57c2..671fbb89652b42ed1b34a2623346715ef6d559c1 100644 (file)
@@ -41,8 +41,8 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor;
+import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
 import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
-import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
 import org.opendaylight.controller.cluster.datastore.config.PrefixShardConfiguration;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils;
@@ -93,8 +93,8 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
     // for calls that need specific actor context tied to a datastore use the one provided in the DistributedDataStore
     private final ActorContext actorContext;
     private final ShardingServiceAddressResolver resolver;
-    private final DistributedDataStore distributedConfigDatastore;
-    private final DistributedDataStore distributedOperDatastore;
+    private final AbstractDataStore distributedConfigDatastore;
+    private final AbstractDataStore distributedOperDatastore;
     private final int lookupTaskMaxRetries;
 
     private final Map<DOMDataTreeIdentifier, ActorProducerRegistration> idToProducer = new HashMap<>();
@@ -768,8 +768,8 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
     public static class ShardedDataTreeActorCreator {
 
         private DistributedShardedDOMDataTree shardingService;
-        private DistributedDataStore distributedConfigDatastore;
-        private DistributedDataStore distributedOperDatastore;
+        private AbstractDataStore distributedConfigDatastore;
+        private AbstractDataStore distributedOperDatastore;
         private ActorSystem actorSystem;
         private ClusterWrapper cluster;
         private int maxRetries;
@@ -801,22 +801,22 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
             return cluster;
         }
 
-        public DistributedDataStore getDistributedConfigDatastore() {
+        public AbstractDataStore getDistributedConfigDatastore() {
             return distributedConfigDatastore;
         }
 
         public ShardedDataTreeActorCreator setDistributedConfigDatastore(
-                final DistributedDataStore distributedConfigDatastore) {
+                final AbstractDataStore distributedConfigDatastore) {
             this.distributedConfigDatastore = distributedConfigDatastore;
             return this;
         }
 
-        public DistributedDataStore getDistributedOperDatastore() {
+        public AbstractDataStore getDistributedOperDatastore() {
             return distributedOperDatastore;
         }
 
         public ShardedDataTreeActorCreator setDistributedOperDatastore(
-                final DistributedDataStore distributedOperDatastore) {
+                final AbstractDataStore distributedOperDatastore) {
             this.distributedOperDatastore = distributedOperDatastore;
             return this;
         }