+ @Override public Optional<String> getModuleNameFromNameSpace(String nameSpace) {
+ for(Module m : modules){
+ if(m.getNameSpace().equals(nameSpace)){
+ return Optional.of(m.getName());
+ }
+ }
+ return Optional.absent();
+ }
+
+ @Override public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
+ Map<String, ShardStrategy> map = new HashMap<>();
+ for(Module m : modules){
+ map.put(m.getName(), m.getShardStrategy());
+ }
+ return map;
+ }
+
+ @Override public List<String> getShardNamesFromModuleName(String moduleName) {
+ 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.EMPTY_LIST;
+ }
+
+ @Override public List<String> getMembersFromShardName(String shardName) {
+ List<String> shards = new ArrayList();
+ for(ModuleShard ms : moduleShards){
+ for(Shard s : ms.getShards()) {
+ if(s.getName().equals(shardName)){
+ return s.getReplicas();
+ }
+ }
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+