Class ConfigurationImpl
- java.lang.Object
-
- org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl
-
- All Implemented Interfaces:
Configuration
public class ConfigurationImpl extends Object implements Configuration
-
-
Constructor Summary
Constructors Constructor Description ConfigurationImpl(String moduleShardsConfigPath, String modulesConfigPath)
ConfigurationImpl(ModuleShardConfigProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMemberReplicaForShard(String shardName, MemberName newMemberName)
Adds the given member as the new replica for the given shardName.void
addModuleShardConfiguration(ModuleShardConfiguration config)
Adds a new configuration for a module and shard.void
addPrefixShardConfiguration(PrefixShardConfiguration config)
Adds a new configuration for a shard based on prefix.Map<DOMDataTreeIdentifier,PrefixShardConfiguration>
getAllPrefixShardConfigurations()
Returns the configuration for all configured prefix shards.Set<String>
getAllShardNames()
Returns all the configured shard names.Collection<MemberName>
getMembersFromShardName(String shardName)
Returns the member replicas for the given shard name.Collection<String>
getMemberShardNames(MemberName memberName)
Returns all the shard names that belong on the member by the given name.String
getModuleNameFromNameSpace(String nameSpace)
Returns the module name for the given namespace name or null if not found.String
getShardNameForModule(String moduleName)
Returns the first shard name corresponding to the given module name or null if none is configured.String
getShardNameForPrefix(DOMDataTreeIdentifier prefix)
Return the shard name corresponding to the prefix, or null if none is configured.ShardStrategy
getStrategyForModule(String moduleName)
Returns the ShardStrategy for the given module name or null if the module is not found.ShardStrategy
getStrategyForPrefix(DOMDataTreeIdentifier prefix)
Returns the ShardStrategy for the given prefix or null if the prefix is not found.Collection<MemberName>
getUniqueMemberNamesForAllShards()
Returns a unique set of all member names configured for all shards.boolean
isShardConfigured(String shardName)
void
removeMemberReplicaForShard(String shardName, MemberName newMemberName)
Removes the given member as a replica for the given shardName.void
removePrefixShardConfiguration(DOMDataTreeIdentifier prefix)
Removes a shard configuration for the specified prefix.
-
-
-
Constructor Detail
-
ConfigurationImpl
public ConfigurationImpl(String moduleShardsConfigPath, String modulesConfigPath)
-
ConfigurationImpl
public ConfigurationImpl(ModuleShardConfigProvider provider)
-
-
Method Detail
-
getMemberShardNames
public Collection<String> getMemberShardNames(MemberName memberName)
Description copied from interface:Configuration
Returns all the shard names that belong on the member by the given name.- Specified by:
getMemberShardNames
in interfaceConfiguration
-
getModuleNameFromNameSpace
public String getModuleNameFromNameSpace(String nameSpace)
Description copied from interface:Configuration
Returns the module name for the given namespace name or null if not found.- Specified by:
getModuleNameFromNameSpace
in interfaceConfiguration
-
getStrategyForModule
public ShardStrategy getStrategyForModule(String moduleName)
Description copied from interface:Configuration
Returns the ShardStrategy for the given module name or null if the module is not found.- Specified by:
getStrategyForModule
in interfaceConfiguration
-
getShardNameForModule
public String getShardNameForModule(String moduleName)
Description copied from interface:Configuration
Returns the first shard name corresponding to the given module name or null if none is configured.- Specified by:
getShardNameForModule
in interfaceConfiguration
-
getShardNameForPrefix
public String getShardNameForPrefix(DOMDataTreeIdentifier prefix)
Description copied from interface:Configuration
Return the shard name corresponding to the prefix, or null if none is configured.- Specified by:
getShardNameForPrefix
in interfaceConfiguration
-
getMembersFromShardName
public Collection<MemberName> getMembersFromShardName(String shardName)
Description copied from interface:Configuration
Returns the member replicas for the given shard name.- Specified by:
getMembersFromShardName
in interfaceConfiguration
-
getAllShardNames
public Set<String> getAllShardNames()
Description copied from interface:Configuration
Returns all the configured shard names.- Specified by:
getAllShardNames
in interfaceConfiguration
-
getUniqueMemberNamesForAllShards
public Collection<MemberName> getUniqueMemberNamesForAllShards()
Description copied from interface:Configuration
Returns a unique set of all member names configured for all shards.- Specified by:
getUniqueMemberNamesForAllShards
in interfaceConfiguration
-
addModuleShardConfiguration
public void addModuleShardConfiguration(ModuleShardConfiguration config)
Description copied from interface:Configuration
Adds a new configuration for a module and shard.- Specified by:
addModuleShardConfiguration
in interfaceConfiguration
-
addPrefixShardConfiguration
public void addPrefixShardConfiguration(PrefixShardConfiguration config)
Description copied from interface:Configuration
Adds a new configuration for a shard based on prefix.- Specified by:
addPrefixShardConfiguration
in interfaceConfiguration
-
removePrefixShardConfiguration
public void removePrefixShardConfiguration(DOMDataTreeIdentifier prefix)
Description copied from interface:Configuration
Removes a shard configuration for the specified prefix.- Specified by:
removePrefixShardConfiguration
in interfaceConfiguration
-
getAllPrefixShardConfigurations
public Map<DOMDataTreeIdentifier,PrefixShardConfiguration> getAllPrefixShardConfigurations()
Description copied from interface:Configuration
Returns the configuration for all configured prefix shards.- Specified by:
getAllPrefixShardConfigurations
in interfaceConfiguration
- Returns:
- An immutable copy of the currently configured prefix shards.
-
isShardConfigured
public boolean isShardConfigured(String shardName)
- Specified by:
isShardConfigured
in interfaceConfiguration
-
addMemberReplicaForShard
public void addMemberReplicaForShard(String shardName, MemberName newMemberName)
Description copied from interface:Configuration
Adds the given member as the new replica for the given shardName.- Specified by:
addMemberReplicaForShard
in interfaceConfiguration
-
removeMemberReplicaForShard
public void removeMemberReplicaForShard(String shardName, MemberName newMemberName)
Description copied from interface:Configuration
Removes the given member as a replica for the given shardName.- Specified by:
removeMemberReplicaForShard
in interfaceConfiguration
-
getStrategyForPrefix
public ShardStrategy getStrategyForPrefix(DOMDataTreeIdentifier prefix)
Description copied from interface:Configuration
Returns the ShardStrategy for the given prefix or null if the prefix is not found.- Specified by:
getStrategyForPrefix
in interfaceConfiguration
-
-