BUG-2138: Allow creation of prefixed ShardDataTrees 18/48218/53
authorTomas Cere <tcere@cisco.com>
Thu, 10 Nov 2016 13:41:30 +0000 (14:41 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 19 Dec 2016 15:26:11 +0000 (15:26 +0000)
This actually starts using the storeRoot field from DataStoreContext
so we can have CDS shards rooted somewhere else than store root.

Change-Id: I304a7678f3077359e7b2c4007e73321544c6e798
Signed-off-by: Tomas Cere <tcere@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java

index 05b3093..1f786e6 100644 (file)
@@ -185,7 +185,8 @@ public class Shard extends RaftActor {
                     treeChangeListenerPublisher, dataChangeListenerPublisher, name);
         } else {
             store = new ShardDataTree(this, builder.getSchemaContext(), builder.getTreeType(),
-                    treeChangeListenerPublisher, dataChangeListenerPublisher, name);
+                    builder.getDatastoreContext().getStoreRoot(), treeChangeListenerPublisher,
+                    dataChangeListenerPublisher, name);
         }
 
         shardMBean = ShardMBeanFactory.getShardStatsMBean(name, datastoreContext.getDataStoreMXBeanType(), this);
index a04bf62..89c381a 100644 (file)
@@ -136,15 +136,17 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     public ShardDataTree(final Shard shard, final SchemaContext schemaContext, final TreeType treeType,
+            final YangInstanceIdentifier root,
             final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher,
             final ShardDataChangeListenerPublisher dataChangeListenerPublisher, final String logContext) {
-        this(shard, schemaContext, InMemoryDataTreeFactory.getInstance().create(treeType),
+        this(shard, schemaContext, InMemoryDataTreeFactory.getInstance().create(treeType, root),
                 treeChangeListenerPublisher, dataChangeListenerPublisher, logContext);
     }
 
     @VisibleForTesting
     public ShardDataTree(final Shard shard, final SchemaContext schemaContext, final TreeType treeType) {
-        this(shard, schemaContext, treeType, new DefaultShardDataTreeChangeListenerPublisher(),
+        this(shard, schemaContext, treeType, YangInstanceIdentifier.EMPTY,
+                new DefaultShardDataTreeChangeListenerPublisher(),
                 new DefaultShardDataChangeListenerPublisher(), "");
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.