Search in sources :

Example 1 with InMemoryBucketStore

use of io.pravega.controller.store.stream.InMemoryBucketStore in project pravega by pravega.

the class BucketServiceFactory method createWatermarkingService.

public BucketManager createWatermarkingService(Duration executionDuration, BucketWork work, ScheduledExecutorService executorService) {
    switch(bucketStore.getStoreType()) {
        case Zookeeper:
            ZookeeperBucketStore zkBucketStore = (ZookeeperBucketStore) bucketStore;
            Function<Integer, BucketService> zkSupplier = bucket -> new ZooKeeperBucketService(BucketStore.ServiceType.WatermarkingService, bucket, zkBucketStore, executorService, maxConcurrentExecutions, executionDuration, work);
            return new ZooKeeperBucketManager(hostId, zkBucketStore, BucketStore.ServiceType.WatermarkingService, executorService, zkSupplier);
        case InMemory:
            InMemoryBucketStore inMemoryBucketStore = (InMemoryBucketStore) bucketStore;
            Function<Integer, BucketService> inMemorySupplier = bucket -> new InMemoryBucketService(BucketStore.ServiceType.WatermarkingService, bucket, inMemoryBucketStore, executorService, maxConcurrentExecutions, executionDuration, work);
            return new InMemoryBucketManager(hostId, (InMemoryBucketStore) bucketStore, BucketStore.ServiceType.WatermarkingService, executorService, inMemorySupplier);
        default:
            throw new IllegalArgumentException(String.format("store type %s not supported", bucketStore.getStoreType().name()));
    }
}
Also used : BucketStore(io.pravega.controller.store.stream.BucketStore) InMemoryBucketStore(io.pravega.controller.store.stream.InMemoryBucketStore) Slf4j(lombok.extern.slf4j.Slf4j) NonNull(lombok.NonNull) ZookeeperBucketStore(io.pravega.controller.store.stream.ZookeeperBucketStore) Duration(java.time.Duration) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Function(java.util.function.Function) InMemoryBucketStore(io.pravega.controller.store.stream.InMemoryBucketStore) ZookeeperBucketStore(io.pravega.controller.store.stream.ZookeeperBucketStore)

Example 2 with InMemoryBucketStore

use of io.pravega.controller.store.stream.InMemoryBucketStore in project pravega by pravega.

the class BucketServiceFactory method createRetentionService.

public BucketManager createRetentionService(Duration executionDuration, BucketWork work, ScheduledExecutorService executorService) {
    switch(bucketStore.getStoreType()) {
        case Zookeeper:
            ZookeeperBucketStore zkBucketStore = (ZookeeperBucketStore) bucketStore;
            Function<Integer, BucketService> zkSupplier = bucket -> new ZooKeeperBucketService(BucketStore.ServiceType.RetentionService, bucket, zkBucketStore, executorService, maxConcurrentExecutions, executionDuration, work);
            return new ZooKeeperBucketManager(hostId, zkBucketStore, BucketStore.ServiceType.RetentionService, executorService, zkSupplier);
        case InMemory:
            InMemoryBucketStore inMemoryBucketStore = (InMemoryBucketStore) bucketStore;
            Function<Integer, BucketService> inMemorySupplier = bucket -> new InMemoryBucketService(BucketStore.ServiceType.RetentionService, bucket, inMemoryBucketStore, executorService, maxConcurrentExecutions, executionDuration, work);
            return new InMemoryBucketManager(hostId, (InMemoryBucketStore) bucketStore, BucketStore.ServiceType.RetentionService, executorService, inMemorySupplier);
        default:
            throw new IllegalArgumentException(String.format("store type %s not supported", bucketStore.getStoreType().name()));
    }
}
Also used : BucketStore(io.pravega.controller.store.stream.BucketStore) InMemoryBucketStore(io.pravega.controller.store.stream.InMemoryBucketStore) Slf4j(lombok.extern.slf4j.Slf4j) NonNull(lombok.NonNull) ZookeeperBucketStore(io.pravega.controller.store.stream.ZookeeperBucketStore) Duration(java.time.Duration) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Function(java.util.function.Function) InMemoryBucketStore(io.pravega.controller.store.stream.InMemoryBucketStore) ZookeeperBucketStore(io.pravega.controller.store.stream.ZookeeperBucketStore)

Aggregations

BucketStore (io.pravega.controller.store.stream.BucketStore)2 InMemoryBucketStore (io.pravega.controller.store.stream.InMemoryBucketStore)2 ZookeeperBucketStore (io.pravega.controller.store.stream.ZookeeperBucketStore)2 Duration (java.time.Duration)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2 Function (java.util.function.Function)2 NonNull (lombok.NonNull)2 Slf4j (lombok.extern.slf4j.Slf4j)2