X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fconfig%2FConfiguration.java;h=a2e19579534a844c4b7cea5ee27e03a657582009;hb=3f2f311927a45635339201f400652c145318e632;hp=4319b3a0b7cdc0b0c68ea6b277ba7a4f0a7f3f43;hpb=ffc46de334c8a903844b9f4aff73dc68b2401659;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java index 4319b3a0b7..a2e1957953 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java @@ -5,63 +5,98 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - 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 org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.controller.cluster.access.concepts.MemberName; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy; +import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; 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 getMemberShardNames(String memberName); + @NonNull Collection getMemberShardNames(@NonNull MemberName 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 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 getModuleNameToShardStrategyMap(); + @Nullable String getShardNameForModule(@NonNull String moduleName); /** - * Given a module name find all the shardNames corresponding to it - * @param moduleName - * @return + * Return the shard name corresponding to the prefix, or null if none is configured. */ - List getShardNamesFromModuleName(String moduleName); + @Nullable String getShardNameForPrefix(@NonNull DOMDataTreeIdentifier prefix); /** - * Given a shardName find all the members on which it belongs - * - * @param shardName - * @return + * Returns the member replicas for the given shard name. */ - List getMembersFromShardName(String shardName); + @NonNull Collection getMembersFromShardName(@NonNull String shardName); /** - * - * @return + * Returns the ShardStrategy for the given module name or null if the module is not found. + */ + @Nullable ShardStrategy getStrategyForModule(@NonNull String moduleName); + + /** + * Returns all the configured shard names. */ Set getAllShardNames(); + /** + * Adds a new configuration for a module and shard. + */ + void addModuleShardConfiguration(@NonNull ModuleShardConfiguration config); + + /** + * Adds a new configuration for a shard based on prefix. + */ + void addPrefixShardConfiguration(@NonNull PrefixShardConfiguration config); + + /** + * Removes a shard configuration for the specified prefix. + */ + void removePrefixShardConfiguration(@NonNull DOMDataTreeIdentifier prefix); + + /** + * Returns the configuration for all configured prefix shards. + * + * @return An immutable copy of the currently configured prefix shards. + */ + Map getAllPrefixShardConfigurations(); + /** * Returns a unique set of all member names configured for all shards. */ - Collection getUniqueMemberNamesForAllShards(); + Collection getUniqueMemberNamesForAllShards(); + + /* + * Verifies if the given module shard in available in the cluster + */ + boolean isShardConfigured(String 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 removeMemberReplicaForShard(String shardName, MemberName memberName); + + /** + * Returns the ShardStrategy for the given prefix or null if the prefix is not found. + */ + @Nullable ShardStrategy getStrategyForPrefix(@NonNull DOMDataTreeIdentifier prefix); }