BUG 2138: Introduce prefix based shards into ShardManager
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / config / Configuration.java
index fa823a7285cab11db22b9f8685d30ccd2fbd91f4..3bf37e0f3812834f0ec5522b95adedb73c00b2b4 100644 (file)
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public interface Configuration {
 
@@ -32,6 +33,11 @@ public interface Configuration {
      */
     @Nullable String getShardNameForModule(@Nonnull String moduleName);
 
+    /**
+     * Return the shard name corresponding to the prefix, or null if none is configured.
+     */
+    @Nullable String getShardNameForPrefix(@Nonnull YangInstanceIdentifier prefix);
+
     /**
      * Returns the member replicas for the given shard name.
      */
@@ -52,6 +58,11 @@ public interface Configuration {
      */
     void addModuleShardConfiguration(@Nonnull ModuleShardConfiguration config);
 
+    /**
+     * Adds a new configuration for a shard based on prefix.
+     */
+    void addPrefixShardConfiguration(@Nonnull PrefixShardConfiguration config);
+
     /**
      * Returns a unique set of all member names configured for all shards.
      */
@@ -63,12 +74,17 @@ public interface Configuration {
     boolean isShardConfigured(String shardName);
 
     /**
-     * Adds the given member as the new replica for the given shardName
+     * Adds the given member as the new replica for the given shardName.
+     */
+    void addMemberReplicaForShard(String shardName, MemberName memberName);
+
+    /**
+     * Removes the given member as a replica for the given shardName.
      */
-    void addMemberReplicaForShard (String shardName, MemberName memberName);
+    void removeMemberReplicaForShard(String shardName, MemberName memberName);
 
     /**
-     * Removes the given member as a replica for the given shardName
+     * Returns the ShardStrategy for the given prefix or null if the prefix is not found.
      */
-    void removeMemberReplicaForShard (String shardName, MemberName memberName);
+    @Nullable ShardStrategy getStrategyForPrefix(@Nonnull YangInstanceIdentifier prefix);
 }