BUG 2187 - JMX API for create/delete shard replica
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / config / Configuration.java
index 4319b3a0b7cdc0b0c68ea6b277ba7a4f0a7f3f43..dea77f5e34ed0cc46306bd108f5fcc6ed0580c11 100644 (file)
@@ -8,60 +8,56 @@
 
 package org.opendaylight.controller.cluster.datastore.config;
 
-import com.google.common.base.Optional;
 import java.util.Collection;
-import java.util.List;
-import java.util.Map;
 import java.util.Set;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
 
 public interface Configuration {
 
     /**
-     * Given a memberName find all the shards that belong on that member and
-     * return the names of those shards
-     *
-     * @param memberName
-     * @return
+     * Returns all the shard names that belong on the member by the given name.
      */
-    List<String> getMemberShardNames(String memberName);
+    @Nonnull Collection<String> getMemberShardNames(@Nonnull String memberName);
 
     /**
-     * Given a module namespace return the name of a module
-     * @param nameSpace
-     * @return
+     * Returns the module name for the given namespace name or null if not found.
      */
-    Optional<String> getModuleNameFromNameSpace(String nameSpace);
+    @Nullable String getModuleNameFromNameSpace(@Nonnull String nameSpace);
 
     /**
-     * Get a mapping of the module names to it's corresponding ShardStrategy
-     * @return
+     * Returns the first shard name corresponding to the given module name or null if none is configured.
      */
-    Map<String, ShardStrategy> getModuleNameToShardStrategyMap();
+    @Nullable String getShardNameForModule(@Nonnull String moduleName);
 
     /**
-     * Given a module name find all the shardNames corresponding to it
-     * @param moduleName
-     * @return
+     * Returns the member replicas for the given shard name.
      */
-    List<String> getShardNamesFromModuleName(String moduleName);
+    @Nonnull Collection<String> getMembersFromShardName(@Nonnull String shardName);
 
     /**
-     * Given a shardName find all the members on which it belongs
-     *
-     * @param shardName
-     * @return
+     * Returns the ShardStrategy for the given module name or null if the module is not found.
      */
-    List<String> getMembersFromShardName(String shardName);
+    @Nullable ShardStrategy getStrategyForModule(@Nonnull String moduleName);
 
     /**
-     *
-     * @return
+     * Returns all the configured shard names.
      */
     Set<String> getAllShardNames();
 
+    /**
+     * Adds a new configuration for a module and shard.
+     */
+    void addModuleShardConfiguration(@Nonnull ModuleShardConfiguration config);
+
     /**
      * Returns a unique set of all member names configured for all shards.
      */
     Collection<String> getUniqueMemberNamesForAllShards();
+
+    /*
+     * Verifies if the given module shard in available in the cluster
+     */
+    boolean isShardConfigured(String shardName);
 }