2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.datastore.config;
11 import java.util.Collection;
14 import javax.annotation.Nonnull;
15 import javax.annotation.Nullable;
16 import org.opendaylight.controller.cluster.access.concepts.MemberName;
17 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
18 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
20 public interface Configuration {
23 * Returns all the shard names that belong on the member by the given name.
25 @Nonnull Collection<String> getMemberShardNames(@Nonnull MemberName memberName);
28 * Returns the module name for the given namespace name or null if not found.
30 @Nullable String getModuleNameFromNameSpace(@Nonnull String nameSpace);
33 * Returns the first shard name corresponding to the given module name or null if none is configured.
35 @Nullable String getShardNameForModule(@Nonnull String moduleName);
38 * Return the shard name corresponding to the prefix, or null if none is configured.
40 @Nullable String getShardNameForPrefix(@Nonnull DOMDataTreeIdentifier prefix);
43 * Returns the member replicas for the given shard name.
45 @Nonnull Collection<MemberName> getMembersFromShardName(@Nonnull String shardName);
48 * Returns the ShardStrategy for the given module name or null if the module is not found.
50 @Nullable ShardStrategy getStrategyForModule(@Nonnull String moduleName);
53 * Returns all the configured shard names.
55 Set<String> getAllShardNames();
58 * Adds a new configuration for a module and shard.
60 void addModuleShardConfiguration(@Nonnull ModuleShardConfiguration config);
63 * Adds a new configuration for a shard based on prefix.
65 void addPrefixShardConfiguration(@Nonnull PrefixShardConfiguration config);
68 * Removes a shard configuration for the specified prefix.
70 void removePrefixShardConfiguration(@Nonnull DOMDataTreeIdentifier prefix);
73 * Returns the configuration for all configured prefix shards.
75 * @return An immutable copy of the currently configured prefix shards.
77 Map<DOMDataTreeIdentifier, PrefixShardConfiguration> getAllPrefixShardConfigurations();
80 * Returns a unique set of all member names configured for all shards.
82 Collection<MemberName> getUniqueMemberNamesForAllShards();
85 * Verifies if the given module shard in available in the cluster
87 boolean isShardConfigured(String shardName);
90 * Adds the given member as the new replica for the given shardName.
92 void addMemberReplicaForShard(String shardName, MemberName memberName);
95 * Removes the given member as a replica for the given shardName.
97 void removeMemberReplicaForShard(String shardName, MemberName memberName);
100 * Returns the ShardStrategy for the given prefix or null if the prefix is not found.
102 @Nullable ShardStrategy getStrategyForPrefix(@Nonnull DOMDataTreeIdentifier prefix);