Bump upstream SNAPSHOTS
[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 package org.opendaylight.controller.cluster.datastore.config;
9
10 import java.util.Collection;
11 import java.util.Set;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.controller.cluster.access.concepts.MemberName;
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     // FIXME: return Set here
23     @NonNull Collection<String> getMemberShardNames(@NonNull MemberName memberName);
24
25     /**
26      * Returns the module name for the given namespace name or null if not found.
27      */
28     @Nullable String getModuleNameFromNameSpace(@NonNull String nameSpace);
29
30     /**
31      * Returns the first shard name corresponding to the given module name or null if none is configured.
32      */
33     @Nullable String getShardNameForModule(@NonNull String moduleName);
34
35     /**
36      * Returns the member replicas for the given shard name.
37      */
38     // FIXME: return Set here
39     @NonNull Collection<MemberName> getMembersFromShardName(@NonNull String shardName);
40
41     /**
42      * Returns the ShardStrategy for the given module name or null if the module is not found.
43      */
44     @Nullable ShardStrategy getStrategyForModule(@NonNull String moduleName);
45
46     /**
47      * Returns all the configured shard names.
48      */
49     Set<String> getAllShardNames();
50
51     /**
52      * Adds a new configuration for a module and shard.
53      */
54     void addModuleShardConfiguration(@NonNull ModuleShardConfiguration config);
55
56     /**
57      * Returns a unique set of all member names configured for all shards.
58      */
59     // FIXME: return Set here
60     Collection<MemberName> getUniqueMemberNamesForAllShards();
61
62     /*
63      * Verifies if the given module shard in available in the cluster
64      */
65     boolean isShardConfigured(String shardName);
66
67     /**
68      * Adds the given member as the new replica for the given shardName.
69      */
70     void addMemberReplicaForShard(String shardName, MemberName memberName);
71
72     /**
73      * Removes the given member as a replica for the given shardName.
74      */
75     void removeMemberReplicaForShard(String shardName, MemberName memberName);
76 }