b6122b3d29f4f07eada831feaa5765c3a073047f
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / config / Configuration.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.cluster.datastore.config;
10
11 import java.util.Collection;
12 import java.util.Set;
13 import javax.annotation.Nonnull;
14 import javax.annotation.Nullable;
15 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
16
17 public interface Configuration {
18
19     /**
20      * Returns all the shard names that belong on the member by the given name.
21      */
22     @Nonnull Collection<String> getMemberShardNames(@Nonnull String memberName);
23
24     /**
25      * Returns the module name for the given namespace name or null if not found.
26      */
27     @Nullable String getModuleNameFromNameSpace(@Nonnull String nameSpace);
28
29     /**
30      * Returns the first shard name corresponding to the given module name or null if none is configured.
31      */
32     @Nullable String getShardNameForModule(@Nonnull String moduleName);
33
34     /**
35      * Returns the member replicas for the given shard name.
36      */
37     @Nonnull Collection<String> getMembersFromShardName(@Nonnull String shardName);
38
39     /**
40      * Returns the ShardStrategy for the given module name or null if the module is not found.
41      */
42     @Nullable ShardStrategy getStrategyForModule(@Nonnull String moduleName);
43
44     /**
45      * Returns all the configured shard names.
46      */
47     Set<String> getAllShardNames();
48
49     /**
50      * Adds a new configuration for a module and shard.
51      */
52     void addModuleShardConfiguration(@Nonnull ModuleShardConfiguration config);
53
54     /**
55      * Returns a unique set of all member names configured for all shards.
56      */
57     Collection<String> getUniqueMemberNamesForAllShards();
58
59     /*
60      * Verifies if the given module shard in available in the cluster
61      */
62     boolean isShardConfigured(String shardName);
63
64     /**
65      * Adds the given member as the new replica for the given shardName
66      */
67     void addMemberReplicaForShard (String shardName, String memberName);
68
69     /**
70      * Removes the given member as a replica for the given shardName
71      */
72     void removeMemberReplicaForShard (String shardName, String memberName);
73 }