use of org.commonjava.storage.pathmapped.pathdb.datastax.CassandraPathDB in project indy by Commonjava.
the class DefaultGalleyStorageProvider method setupCacheProviderFactory.
private void setupCacheProviderFactory() {
final File storeRoot = config.getStorageRootDirectory();
if (indyConfiguration.isStandalone()) {
logger.info("We're in standalone content-storage mode. Cassandra path-mapping database will NOT be used");
// Only work for local debug mode.
ScheduledExecutorService debugDeleteExecutor = Executors.newScheduledThreadPool(5, new NamedThreadFactory("debug-galley-delete-executor", new ThreadGroup("debug-galley-delete-executor"), true, 2));
cacheProviderFactory = new PartyLineCacheProviderFactory(storeRoot, debugDeleteExecutor);
return;
}
logger.info("Initializing Cassandra-based path-mapping database for content storage.");
PathDB pathDB = null;
PathMappedStorageConfig pathMappedStorageConfig = getPathMappedStorageConfig();
if (cassandraClient != null) {
String keyspace = config.getCassandraKeyspace();
Session session = cassandraClient.getSession(keyspace);
if (session != null) {
logger.info("Create pathDB, keyspace: {}", keyspace);
pathDB = new CassandraPathDB(pathMappedStorageConfig, session, keyspace, getReplicationFactor());
}
}
if (pathDB != null) {
if (metricsConfig.isPathDBMetricsEnabled()) {
final String operations = metricsConfig.getPathDBMetricsOperations();
logger.info("Create measured PathDB, operations: {}");
pathDB = new MeasuredPathDB(pathDB, metricsManager, getSupername("pathDB")) {
@Override
protected boolean isMetricEnabled(String metricName) {
if (isBlank(operations) || operations.contains(metricName)) {
return true;
}
return false;
}
};
}
}
File legacyBaseDir = config.getLegacyStorageBasedir();
PhysicalStore physicalStore = new LegacyReadonlyPhysicalStore(storeRoot, legacyBaseDir);
logger.info("Create cacheProviderFactory, pathDB: {}, physicalStore: {}", pathDB, physicalStore);
cacheProviderFactory = new PathMappedCacheProviderFactory(storeRoot, deleteExecutor, pathMappedStorageConfig, pathDB, physicalStore);
}
Aggregations