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;
13 import javax.annotation.Nonnull;
14 import javax.annotation.Nullable;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 public interface Configuration {
22 * Returns all the shard names that belong on the member by the given name.
24 @Nonnull Collection<String> getMemberShardNames(@Nonnull MemberName memberName);
27 * Returns the module name for the given namespace name or null if not found.
29 @Nullable String getModuleNameFromNameSpace(@Nonnull String nameSpace);
32 * Returns the first shard name corresponding to the given module name or null if none is configured.
34 @Nullable String getShardNameForModule(@Nonnull String moduleName);
37 * Return the shard name corresponding to the prefix, or null if none is configured.
39 @Nullable String getShardNameForPrefix(@Nonnull YangInstanceIdentifier prefix);
42 * Returns the member replicas for the given shard name.
44 @Nonnull Collection<MemberName> getMembersFromShardName(@Nonnull String shardName);
47 * Returns the ShardStrategy for the given module name or null if the module is not found.
49 @Nullable ShardStrategy getStrategyForModule(@Nonnull String moduleName);
52 * Returns all the configured shard names.
54 Set<String> getAllShardNames();
57 * Adds a new configuration for a module and shard.
59 void addModuleShardConfiguration(@Nonnull ModuleShardConfiguration config);
62 * Adds a new configuration for a shard based on prefix.
64 void addPrefixShardConfiguration(@Nonnull PrefixShardConfiguration config);
67 * Returns a unique set of all member names configured for all shards.
69 Collection<MemberName> getUniqueMemberNamesForAllShards();
72 * Verifies if the given module shard in available in the cluster
74 boolean isShardConfigured(String shardName);
77 * Adds the given member as the new replica for the given shardName.
79 void addMemberReplicaForShard(String shardName, MemberName memberName);
82 * Removes the given member as a replica for the given shardName.
84 void removeMemberReplicaForShard(String shardName, MemberName memberName);
87 * Returns the ShardStrategy for the given prefix or null if the prefix is not found.
89 @Nullable ShardStrategy getStrategyForPrefix(@Nonnull YangInstanceIdentifier prefix);