use of io.pravega.controller.store.stream.OperationContext 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));
}
Aggregations