use of io.pravega.shared.controller.event.DeleteStreamEvent in project pravega by pravega.
the class DeleteStreamTask method execute.
@Override
public CompletableFuture<Void> execute(final DeleteStreamEvent request) {
final OperationContext context = streamMetadataStore.createContext(request.getScope(), request.getStream());
String scope = request.getScope();
String stream = request.getStream();
return streamMetadataStore.isSealed(scope, stream, context, executor).thenComposeAsync(sealed -> {
if (!sealed) {
log.warn("{}/{} stream not sealed", scope, stream);
return Futures.failedFuture(new RuntimeException("Stream not sealed"));
}
return notifyAndDelete(context, scope, stream);
}, executor).exceptionally(e -> {
if (e instanceof StoreException.DataNotFoundException) {
return null;
}
log.error("{}/{} stream delete workflow threw exception.", scope, stream, e);
throw new CompletionException(e);
});
}
Aggregations