+ private final List<ModuleShard> moduleShards;
+
+ private final List<Module> modules;
+
+ private static final Logger
+ LOG = LoggerFactory.getLogger(DistributedDataStore.class);
+
+ // Look up maps to speed things up
+
+ // key = memberName, value = list of shardNames
+ private final Map<String, List<String>> memberShardNames = new HashMap<>();
+
+ // key = shardName, value = list of replicaNames (replicaNames are the same as memberNames)
+ private final Map<String, List<String>> shardReplicaNames = new HashMap<>();
+
+ private final ListMultimap<String, String> moduleNameToShardName;
+ private final Map<String, ShardStrategy> moduleNameToStrategy;
+ private final Map<String, String> namespaceToModuleName;
+ private final Set<String> allShardNames;
+
+ public ConfigurationImpl(final String moduleShardsConfigPath,
+
+ final String modulesConfigPath){
+
+ Preconditions.checkNotNull(moduleShardsConfigPath, "moduleShardsConfigPath should not be null");
+ Preconditions.checkNotNull(modulesConfigPath, "modulesConfigPath should not be null");
+
+
+ File moduleShardsFile = new File("./configuration/initial/" + moduleShardsConfigPath);
+ File modulesFile = new File("./configuration/initial/" + modulesConfigPath);
+
+ Config moduleShardsConfig = null;
+ if(moduleShardsFile.exists()) {
+ LOG.info("module shards config file exists - reading config from it");
+ moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile);
+ } else {
+ LOG.warn("module shards configuration read from resource");
+ moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath);
+ }
+
+ Config modulesConfig = null;
+ if(modulesFile.exists()) {
+ LOG.info("modules config file exists - reading config from it");
+ modulesConfig = ConfigFactory.parseFile(modulesFile);
+ } else {
+ LOG.warn("modules configuration read from resource");
+ modulesConfig = ConfigFactory.load(modulesConfigPath);
+ }