use of io.pravega.segmentstore.storage.mocks.InMemoryStorageFactory in project pravega by pravega.
the class DebugRecoveryProcessor method create.
/**
* Creates a new instance of the DebugRecoveryProcessor class with the given arguments.
*
* @param containerId The Id of the Container to recover.
* @param durableDataLog A DurableDataLog to recover from.
* @param config A ContainerConfig to use during recovery.
* @param readIndexConfig A ReadIndexConfig to use during recovery.
* @param executor An Executor to use for background tasks.
* @param callbacks Callbacks to invoke during recovery.
* @return A new instance of the DebugRecoveryProcessor.
*/
public static DebugRecoveryProcessor create(int containerId, DurableDataLog durableDataLog, ContainerConfig config, ReadIndexConfig readIndexConfig, ScheduledExecutorService executor, OperationCallbacks callbacks) {
Preconditions.checkNotNull(durableDataLog, "durableDataLog");
Preconditions.checkNotNull(config, "config");
Preconditions.checkNotNull(readIndexConfig, "readIndexConfig");
Preconditions.checkNotNull(executor, "executor");
Preconditions.checkNotNull(callbacks, callbacks);
StreamSegmentContainerMetadata metadata = new StreamSegmentContainerMetadata(containerId, config.getMaxActiveSegmentCount());
ContainerReadIndexFactory rf = new ContainerReadIndexFactory(readIndexConfig, new NoOpCacheFactory(), executor);
Storage s = new InMemoryStorageFactory(executor).createStorageAdapter();
return new DebugRecoveryProcessor(metadata, durableDataLog, rf, s, callbacks);
}
use of io.pravega.segmentstore.storage.mocks.InMemoryStorageFactory in project pravega by pravega.
the class ServiceBuilder method newInMemoryBuilder.
/**
* Creates a new instance of the ServiceBuilder class which is contained in memory. Any data added to this service will
* be lost when the object is garbage collected or the process terminates.
*
* @param builderConfig The ServiceBuilderConfig to use.
* @param executorBuilder A Function that, given a thread count and a pool name, creates a ScheduledExecutorService
* with the given number of threads that have the given name as prefix.
*/
@VisibleForTesting
public static ServiceBuilder newInMemoryBuilder(ServiceBuilderConfig builderConfig, ExecutorBuilder executorBuilder) {
ServiceConfig serviceConfig = builderConfig.getConfig(ServiceConfig::builder);
ServiceBuilder builder;
if (serviceConfig.isReadOnlySegmentStore()) {
// Only components required for ReadOnly SegmentStore.
builder = new ReadOnlyServiceBuilder(builderConfig, serviceConfig, executorBuilder);
} else {
// Components that are required for general SegmentStore.
builder = new ServiceBuilder(builderConfig, serviceConfig, executorBuilder).withCacheFactory(setup -> new InMemoryCacheFactory());
}
// Components that are required for all types of SegmentStore.
return builder.withDataLogFactory(setup -> new InMemoryDurableDataLogFactory(setup.getCoreExecutor())).withContainerManager(setup -> new LocalSegmentContainerManager(setup.getContainerRegistry(), setup.getSegmentToContainerMapper())).withStorageFactory(setup -> new InMemoryStorageFactory(setup.getStorageExecutor())).withStreamSegmentStore(setup -> new StreamSegmentService(setup.getContainerRegistry(), setup.getSegmentToContainerMapper()));
}
use of io.pravega.segmentstore.storage.mocks.InMemoryStorageFactory in project pravega by pravega.
the class StreamSegmentServiceTests method setUp.
@Before
public void setUp() {
this.storageFactory = new InMemoryStorageFactory(executorService());
this.durableDataLogFactory = new PermanentDurableDataLogFactory(executorService());
}
Aggregations