+ @Override public List<String> getShardNamesFromModuleName(final String moduleName) {
+
+ Preconditions.checkNotNull(moduleName, "moduleName should not be null");
+
+ // FIXME: can be constant view of moduleShards
+ for(ModuleShard m : moduleShards){
+ if(m.getModuleName().equals(moduleName)){
+ List<String> l = new ArrayList<>();
+ for(Shard s : m.getShards()){
+ l.add(s.getName());
+ }
+ return l;
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ @Override public List<String> getMembersFromShardName(final String shardName) {
+
+ Preconditions.checkNotNull(shardName, "shardName should not be null");
+
+ if(shardReplicaNames.containsKey(shardName)){
+ return shardReplicaNames.get(shardName);
+ }
+
+ for(ModuleShard ms : moduleShards){
+ for(Shard s : ms.getShards()) {
+ if(s.getName().equals(shardName)){
+ List<String> replicas = s.getReplicas();
+ shardReplicaNames.put(shardName, replicas);
+ return replicas;
+ }
+ }
+ }
+ shardReplicaNames.put(shardName, Collections.<String>emptyList());
+ return Collections.emptyList();
+ }
+
+ @Override public Set<String> getAllShardNames() {
+ Set<String> shardNames = new LinkedHashSet<>();
+ for(ModuleShard ms : moduleShards){
+ for(Shard s : ms.getShards()) {
+ shardNames.add(s.getName());
+ }
+ }
+ return shardNames;
+ }
+
+
+
+ private List<Module> readModules(final Config modulesConfig) {