use of io.pravega.segmentstore.storage.noop.StorageExtraConfig in project pravega by pravega.
the class StorageLoader method load.
public StorageFactory load(ConfigSetup setup, String storageImplementation, StorageLayoutType storageLayoutType, ScheduledExecutorService executor) {
ServiceLoader<StorageFactoryCreator> loader = ServiceLoader.load(StorageFactoryCreator.class);
StorageExtraConfig noOpConfig = setup.getConfig(StorageExtraConfig::builder);
for (StorageFactoryCreator factoryCreator : loader) {
val factories = factoryCreator.getStorageFactories();
for (val factoryInfo : factories) {
log.info("Loading {}, trying {}", storageImplementation, factoryInfo);
if (factoryInfo.getName().equals(storageImplementation) && factoryInfo.getStorageLayoutType() == storageLayoutType) {
StorageFactory factory = factoryCreator.createFactory(factoryInfo, setup, executor);
if (!noOpConfig.isStorageNoOpMode()) {
return factory;
} else {
// The specified storage implementation is in No-Op mode.
log.warn("{} IS IN NO-OP MODE: DATA LOSS WILL HAPPEN! MAKE SURE IT IS BY FULL INTENTION FOR TESTING PURPOSE!", storageImplementation);
return new NoOpStorageFactory(noOpConfig, executor, factory, null);
}
}
}
}
return null;
}
Aggregations