Migrate nullness annotations
[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.Map;
12 import java.util.Set;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
17 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
18
19 public interface Configuration {
20
21     /**
22      * Returns all the shard names that belong on the member by the given name.
23      */
24     @NonNull Collection<String> getMemberShardNames(@NonNull MemberName memberName);
25
26     /**
27      * Returns the module name for the given namespace name or null if not found.
28      */
29     @Nullable String getModuleNameFromNameSpace(@NonNull String nameSpace);
30
31     /**
32      * Returns the first shard name corresponding to the given module name or null if none is configured.
33      */
34     @Nullable String getShardNameForModule(@NonNull String moduleName);
35
36     /**
37      * Return the shard name corresponding to the prefix, or null if none is configured.
38      */
39     @Nullable String getShardNameForPrefix(@NonNull DOMDataTreeIdentifier prefix);
40
41     /**
42      * Returns the member replicas for the given shard name.
43      */
44     @NonNull Collection<MemberName> getMembersFromShardName(@NonNull String shardName);
45
46     /**
47      * Returns the ShardStrategy for the given module name or null if the module is not found.
48      */
49     @Nullable ShardStrategy getStrategyForModule(@NonNull String moduleName);
50
51     /**
52      * Returns all the configured shard names.
53      */
54     Set<String> getAllShardNames();
55
56     /**
57      * Adds a new configuration for a module and shard.
58      */
59     void addModuleShardConfiguration(@NonNull ModuleShardConfiguration config);
60
61     /**
62      * Adds a new configuration for a shard based on prefix.
63      */
64     void addPrefixShardConfiguration(@NonNull PrefixShardConfiguration config);
65
66     /**
67      * Removes a shard configuration for the specified prefix.
68      */
69     void removePrefixShardConfiguration(@NonNull DOMDataTreeIdentifier prefix);
70
71     /**
72      * Returns the configuration for all configured prefix shards.
73      *
74      * @return An immutable copy of the currently configured prefix shards.
75      */
76     Map<DOMDataTreeIdentifier, PrefixShardConfiguration> getAllPrefixShardConfigurations();
77
78     /**
79      * Returns a unique set of all member names configured for all shards.
80      */
81     Collection<MemberName> getUniqueMemberNamesForAllShards();
82
83     /*
84      * Verifies if the given module shard in available in the cluster
85      */
86     boolean isShardConfigured(String shardName);
87
88     /**
89      * Adds the given member as the new replica for the given shardName.
90      */
91     void addMemberReplicaForShard(String shardName, MemberName memberName);
92
93     /**
94      * Removes the given member as a replica for the given shardName.
95      */
96     void removeMemberReplicaForShard(String shardName, MemberName memberName);
97
98     /**
99      * Returns the ShardStrategy for the given prefix or null if the prefix is not found.
100      */
101     @Nullable ShardStrategy getStrategyForPrefix(@NonNull DOMDataTreeIdentifier prefix);
102 }