use of io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_READER_GROUP in project pravega by pravega.
the class ControllerImpl method deleteReaderGroup.
@Override
public CompletableFuture<Boolean> deleteReaderGroup(final String scope, final String rgName, final UUID readerGroupId) {
Exceptions.checkNotClosed(closed.get(), this);
Exceptions.checkNotNullOrEmpty(scope, "scope");
Exceptions.checkNotNullOrEmpty(rgName, "rgName");
Preconditions.checkNotNull(readerGroupId, "rgId");
final long requestId = requestIdGenerator.get();
long traceId = LoggerHelpers.traceEnter(log, "deleteReaderGroup", scope, rgName, requestId);
final String scopedRGName = NameUtils.getScopedReaderGroupName(scope, rgName);
final CompletableFuture<DeleteReaderGroupStatus> result = this.retryConfig.runAsync(() -> {
RPCAsyncCallback<DeleteReaderGroupStatus> callback = new RPCAsyncCallback<>(requestId, "deleteReaderGroup", scope, rgName);
new ControllerClientTagger(client, timeoutMillis).withTag(requestId, DELETE_READER_GROUP, scope, rgName).deleteReaderGroup(ModelHelper.createReaderGroupInfo(scope, rgName, readerGroupId.toString(), 0L), callback);
return callback.getFuture();
}, this.executor);
return result.thenApplyAsync(x -> {
switch(x.getStatus()) {
case FAILURE:
log.warn(requestId, "Failed to delete reader group: {}", scopedRGName);
throw new ControllerFailureException("Failed to delete reader group: " + scopedRGName);
case RG_NOT_FOUND:
log.warn(requestId, "ReaderGroup not found: {}", scopedRGName);
throw new ReaderGroupNotFoundException(scopedRGName);
case SUCCESS:
log.info(requestId, "Successfully deleted Reader Group: {}", scopedRGName);
return true;
case UNRECOGNIZED:
default:
throw new ControllerFailureException("Unknown return status getting config for ReaderGroup " + scopedRGName + " " + x.getStatus());
}
}, this.executor).whenComplete((x, e) -> {
if (e != null) {
log.warn(requestId, "deleteReaderGroup failed for Reader Group: {}", scopedRGName, e);
}
LoggerHelpers.traceLeave(log, "deleteReaderGroup", traceId, scope, rgName, requestId);
});
}
Aggregations