Search in sources :

Example 6 with Scope

use of io.pravega.controller.store.Scope in project pravega by pravega.

the class AbstractKVTableMetadataStore method deleteKeyValueTable.

@Override
public CompletableFuture<Void> deleteKeyValueTable(final String scope, final String name, final OperationContext ctx, final Executor executor) {
    OperationContext kvtContext = getOperationContext(ctx);
    KeyValueTable kvTable = getKVTable(scope, name, kvtContext);
    return Futures.completeOn(Futures.exceptionallyExpecting(kvTable.getActiveEpochRecord(true, kvtContext).thenApply(epoch -> epoch.getSegments().stream().map(KVTSegmentRecord::getSegmentNumber).reduce(Integer::max).get()).thenCompose(lastActiveSegment -> recordLastKVTableSegment(scope, name, lastActiveSegment, kvtContext, executor)), DATA_NOT_FOUND_PREDICATE, null).thenCompose(v -> kvTable.delete(kvtContext)), executor).thenCompose(v -> deleteFromScope(scope, name, kvtContext, executor));
}
Also used : OperationContext(io.pravega.controller.store.stream.OperationContext) ControllerService(io.pravega.controller.server.ControllerService) OperationContext(io.pravega.controller.store.stream.OperationContext) LoadingCache(com.google.common.cache.LoadingCache) Getter(lombok.Getter) Executor(java.util.concurrent.Executor) Predicate(java.util.function.Predicate) Exceptions(io.pravega.common.Exceptions) Set(java.util.Set) Scope(io.pravega.controller.store.Scope) CompletableFuture(java.util.concurrent.CompletableFuture) KeyValueTableConfiguration(io.pravega.client.tables.KeyValueTableConfiguration) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault) HostIndex(io.pravega.controller.store.index.HostIndex) CacheLoader(com.google.common.cache.CacheLoader) KVTSegmentRecord(io.pravega.controller.store.kvtable.records.KVTSegmentRecord) TimeUnit(java.util.concurrent.TimeUnit) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) VersionedMetadata(io.pravega.controller.store.VersionedMetadata) StoreException(io.pravega.controller.store.stream.StoreException) Pair(org.apache.commons.lang3.tuple.Pair) CacheBuilder(com.google.common.cache.CacheBuilder) Futures(io.pravega.common.concurrent.Futures) KVTSegmentRecord(io.pravega.controller.store.kvtable.records.KVTSegmentRecord)

Aggregations

Scope (io.pravega.controller.store.Scope)6 Futures (io.pravega.common.concurrent.Futures)3 List (java.util.List)3 Set (java.util.Set)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 Executor (java.util.concurrent.Executor)3 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)3 Pair (org.apache.commons.lang3.tuple.Pair)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 CacheBuilder (com.google.common.cache.CacheBuilder)2 CacheLoader (com.google.common.cache.CacheLoader)2 LoadingCache (com.google.common.cache.LoadingCache)2 ReaderGroupConfig (io.pravega.client.stream.ReaderGroupConfig)2 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)2 Exceptions (io.pravega.common.Exceptions)2 Int96 (io.pravega.common.lang.Int96)2 ControllerService (io.pravega.controller.server.ControllerService)2 Version (io.pravega.controller.store.Version)2 VersionedMetadata (io.pravega.controller.store.VersionedMetadata)2 HostIndex (io.pravega.controller.store.index.HostIndex)2