@Override public Map<String, String> toConfig(Config jobConfig) { Map<String, String> tableConfig = new HashMap<>(super.toConfig(jobConfig)); // Store factory configuration tableConfig.put(String.format(StorageConfig.FACTORY(), tableId), InMemoryKeyValueStorageEngineFactory.class.getName()); return Collections.unmodifiableMap(tableConfig); } }
@Override public Map<String, String> generateConfig(Config jobConfig, Map<String, String> generatedConfig) { Map<String, String> tableConfig = new HashMap<>(); // Store factory configuration tableConfig.put(String.format( StorageConfig.FACTORY(), tableSpec.getId()), InMemoryKeyValueStorageEngineFactory.class.getName()); // Common store configuration tableConfig.putAll(generateCommonStoreConfig(jobConfig, generatedConfig)); // Rest of the configuration tableSpec.getConfig().entrySet().stream() .filter(e -> !e.getKey().startsWith("internal.")) .forEach(e -> { String k = e.getKey(); String v = e.getValue(); String realKey = k.startsWith("inmemory.") ? String.format("stores.%s", tableSpec.getId()) + "." + k.substring("inmemory.".length()) : String.format(JavaTableConfig.TABLE_ID_PREFIX, tableSpec.getId()) + "." + k; tableConfig.put(realKey, v); }); logger.info("Generated configuration for table " + tableSpec.getId()); return tableConfig; }
@Override public Map<String, String> generateConfig(Config jobConfig, Map<String, String> generatedConfig) { Map<String, String> tableConfig = new HashMap<>(); // Store factory configuration tableConfig.put(String.format( StorageConfig.FACTORY(), tableSpec.getId()), RocksDbKeyValueStorageEngineFactory.class.getName()); // Common store configuration tableConfig.putAll(generateCommonStoreConfig(jobConfig, generatedConfig)); // Rest of the configuration tableSpec.getConfig().entrySet().stream() .filter(e -> !e.getKey().startsWith("internal.")) .forEach(e -> { String k = e.getKey(); String v = e.getValue(); String realKey = k.startsWith("rocksdb.") ? String.format("stores.%s", tableSpec.getId()) + "." + k.substring("rocksdb.".length()) : String.format(JavaTableConfig.TABLE_ID_PREFIX, tableSpec.getId()) + "." + k; tableConfig.put(realKey, v); }); // Enable host affinity tableConfig.put(ClusterManagerConfig.CLUSTER_MANAGER_HOST_AFFINITY_ENABLED, "true"); logger.info("Generated configuration for table " + tableSpec.getId()); return tableConfig; }
@Override public Map<String, String> generateConfig(Config jobConfig, Map<String, String> generatedConfig) { Map<String, String> tableConfig = new HashMap<>(); // Store factory configuration tableConfig.put(String.format( StorageConfig.FACTORY(), tableSpec.getId()), RocksDbKeyValueStorageEngineFactory.class.getName()); // Common store configuration tableConfig.putAll(generateCommonStoreConfig(jobConfig, generatedConfig)); // Rest of the configuration tableSpec.getConfig().entrySet().stream() .filter(e -> !e.getKey().startsWith("internal.")) .forEach(e -> { String k = e.getKey(); String v = e.getValue(); String realKey = k.startsWith("rocksdb.") ? String.format("stores.%s", tableSpec.getId()) + "." + k.substring("rocksdb.".length()) : String.format(JavaTableConfig.TABLE_ID_PREFIX, tableSpec.getId()) + "." + k; tableConfig.put(realKey, v); }); // Enable host affinity tableConfig.put(ClusterManagerConfig.CLUSTER_MANAGER_HOST_AFFINITY_ENABLED, "true"); logger.info("Generated configuration for table " + tableSpec.getId()); return tableConfig; }
public JavaStorageConfig getStorageConfigs() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(StorageConfig.FACTORY(), this.getStoreName()), this.getStoreFactory()); configs.put(String.format(StorageConfig.CHANGELOG_STREAM(), this.getStoreName()), this.getChangelogStream()); configs.putAll(this.getOtherProperties()); return new JavaStorageConfig(new MapConfig(configs)); }
public JavaStorageConfig getStorageConfigs() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(StorageConfig.FACTORY(), this.getStoreName()), this.getStoreFactory()); configs.put(String.format(StorageConfig.CHANGELOG_STREAM(), this.getStoreName()), this.getChangelogStream()); configs.putAll(this.getOtherProperties()); return new JavaStorageConfig(new MapConfig(configs)); }
public JavaStorageConfig getStorageConfigs() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(StorageConfig.FACTORY(), this.getStoreName()), this.getStoreFactory()); configs.put(String.format(StorageConfig.CHANGELOG_STREAM(), this.getStoreName()), this.getChangelogStream()); configs.putAll(this.getOtherProperties()); return new JavaStorageConfig(new MapConfig(configs)); }
public JavaStorageConfig getStorageConfigs() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(StorageConfig.FACTORY(), this.getStoreName()), this.getStoreFactory()); configs.put(String.format(StorageConfig.CHANGELOG_STREAM(), this.getStoreName()), this.getChangelogStream()); configs.putAll(this.getOtherProperties()); return new JavaStorageConfig(new MapConfig(configs)); }
public JavaStorageConfig getStorageConfigs() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(StorageConfig.FACTORY(), this.getStoreName()), this.getStoreFactory()); configs.put(String.format(StorageConfig.CHANGELOG_STREAM(), this.getStoreName()), this.getChangelogStream()); configs.putAll(this.getOtherProperties()); return new JavaStorageConfig(new MapConfig(configs)); }
tableConfig.put(String.format(StorageConfig.FACTORY(), tableId), RocksDbKeyValueStorageEngineFactory.class.getName());
@Test public void testTableProviderFactoryConfig() { Map<String, String> tableConfig = createTableDescriptor() .toConfig(createJobConfig()); Assert.assertEquals(2, tableConfig.size()); Assert.assertEquals(LocalTableProviderFactory.class.getName(), tableConfig.get(String.format(JavaTableConfig.TABLE_PROVIDER_FACTORY, TABLE_ID))); Assert.assertEquals(RocksDbKeyValueStorageEngineFactory.class.getName(), tableConfig.get(String.format(StorageConfig.FACTORY(), TABLE_ID))); }
@Test public void testTableProviderFactoryConfig() { Map<String, String> tableConfig = createTableDescriptor() .toConfig(createJobConfig()); Assert.assertEquals(2, tableConfig.size()); Assert.assertEquals(LocalTableProviderFactory.class.getName(), tableConfig.get(String.format(JavaTableConfig.TABLE_PROVIDER_FACTORY, TABLE_ID))); Assert.assertEquals(InMemoryKeyValueStorageEngineFactory.class.getName(), tableConfig.get(String.format(StorageConfig.FACTORY(), TABLE_ID))); }