Search in sources :

Example 1 with ContainerReadIndexFactory

use of io.pravega.segmentstore.server.reading.ContainerReadIndexFactory 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());
    CacheManager cacheManager = new CacheManager(new CachePolicy(Long.MAX_VALUE, Duration.ofHours(10), Duration.ofHours(1)), new NoOpCache(), executor);
    cacheManager.startAsync().awaitRunning();
    ContainerReadIndexFactory rf = new ContainerReadIndexFactory(readIndexConfig, cacheManager, executor);
    Storage s = new InMemoryStorageFactory(executor).createStorageAdapter();
    return new DebugRecoveryProcessor(metadata, durableDataLog, rf, s, cacheManager, callbacks);
}
Also used : CachePolicy(io.pravega.segmentstore.server.CachePolicy) Storage(io.pravega.segmentstore.storage.Storage) NoOpCache(io.pravega.segmentstore.storage.cache.NoOpCache) ContainerReadIndexFactory(io.pravega.segmentstore.server.reading.ContainerReadIndexFactory) CacheManager(io.pravega.segmentstore.server.CacheManager) InMemoryStorageFactory(io.pravega.segmentstore.storage.mocks.InMemoryStorageFactory) StreamSegmentContainerMetadata(io.pravega.segmentstore.server.containers.StreamSegmentContainerMetadata)

Example 2 with ContainerReadIndexFactory

use of io.pravega.segmentstore.server.reading.ContainerReadIndexFactory in project pravega by pravega.

the class ServiceBuilder method createReadIndexFactory.

protected ReadIndexFactory createReadIndexFactory() {
    CacheFactory cacheFactory = getSingleton(this.cacheFactory, this.cacheFactoryCreator);
    ReadIndexConfig readIndexConfig = this.serviceBuilderConfig.getConfig(ReadIndexConfig::builder);
    return new ContainerReadIndexFactory(readIndexConfig, cacheFactory, this.coreExecutor);
}
Also used : ReadIndexConfig(io.pravega.segmentstore.server.reading.ReadIndexConfig) ContainerReadIndexFactory(io.pravega.segmentstore.server.reading.ContainerReadIndexFactory) CacheFactory(io.pravega.segmentstore.storage.CacheFactory) InMemoryCacheFactory(io.pravega.segmentstore.storage.mocks.InMemoryCacheFactory)

Aggregations

ContainerReadIndexFactory (io.pravega.segmentstore.server.reading.ContainerReadIndexFactory)2 CacheManager (io.pravega.segmentstore.server.CacheManager)1 CachePolicy (io.pravega.segmentstore.server.CachePolicy)1 StreamSegmentContainerMetadata (io.pravega.segmentstore.server.containers.StreamSegmentContainerMetadata)1 ReadIndexConfig (io.pravega.segmentstore.server.reading.ReadIndexConfig)1 CacheFactory (io.pravega.segmentstore.storage.CacheFactory)1 Storage (io.pravega.segmentstore.storage.Storage)1 NoOpCache (io.pravega.segmentstore.storage.cache.NoOpCache)1 InMemoryCacheFactory (io.pravega.segmentstore.storage.mocks.InMemoryCacheFactory)1 InMemoryStorageFactory (io.pravega.segmentstore.storage.mocks.InMemoryStorageFactory)1