BUG-2138: Make DistributedShardFactory return Futures.
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / utils / ClusterUtils.java
index 4b60f61..607e78c 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Map;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.config.PrefixShardConfiguration;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -27,7 +28,10 @@ public class ClusterUtils {
 
     // key for replicated configuration key
     public static final Key<ORMap<PrefixShardConfiguration>> CONFIGURATION_KEY =
-            ORMapKey.create("prefix-shard-configuration");
+            ORMapKey.create("prefix-shard-configuration-config");
+
+    public static final Key<ORMap<PrefixShardConfiguration>> OPERATIONAL_KEY =
+            ORMapKey.create("prefix-shard-configuration-oper");
 
     public static ShardIdentifier getShardIdentifier(final MemberName memberName, final DOMDataTreeIdentifier prefix) {
         final String type;
@@ -76,4 +80,17 @@ public class ClusterUtils {
         });
         return builder.toString();
     }
+
+    public static Key<ORMap<PrefixShardConfiguration>> getReplicatorKey(LogicalDatastoreType type) {
+        if (LogicalDatastoreType.CONFIGURATION.equals(type)) {
+            return CONFIGURATION_KEY;
+        } else {
+            return OPERATIONAL_KEY;
+        }
+    }
+
+    public static org.opendaylight.mdsal.common.api.LogicalDatastoreType toMDSalApi(
+            final LogicalDatastoreType logicalDatastoreType) {
+        return org.opendaylight.mdsal.common.api.LogicalDatastoreType.valueOf(logicalDatastoreType.name());
+    }
 }

©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.