use of io.pravega.shared.controller.tracing.RPCTracingTags.GET_EPOCH_SEGMENTS in project pravega by pravega.
the class ControllerImpl method getEpochSegments.
@Override
public CompletableFuture<StreamSegments> getEpochSegments(final String scope, final String stream, int epoch) {
Exceptions.checkNotClosed(closed.get(), this);
Exceptions.checkNotNullOrEmpty(scope, "scope");
Exceptions.checkNotNullOrEmpty(stream, "stream");
Exceptions.checkArgument(epoch >= 0, "epoch", "Should be a positive integer");
final long requestId = requestIdGenerator.get();
long traceId = LoggerHelpers.traceEnter(log, "getEpochSegments", scope, stream, epoch, requestId);
final CompletableFuture<SegmentRanges> result = this.retryConfig.runAsync(() -> {
RPCAsyncCallback<SegmentRanges> callback = new RPCAsyncCallback<>(traceId, "getEpochSegments", scope, stream, Integer.toString(epoch));
GetEpochSegmentsRequest request = GetEpochSegmentsRequest.newBuilder().setStreamInfo(ModelHelper.createStreamInfo(scope, stream)).setEpoch(epoch).build();
new ControllerClientTagger(client, timeoutMillis).withTag(requestId, GET_EPOCH_SEGMENTS, scope, stream, Integer.toString(epoch)).getEpochSegments(request, callback);
return callback.getFuture();
}, this.executor);
return result.thenApplyAsync(x -> getStreamSegments(x, requestId), this.executor).whenComplete((x, e) -> {
if (e != null) {
log.warn(requestId, "getEpochSegments for {}/{} with epoch {} failed: ", scope, stream, epoch, e);
}
LoggerHelpers.traceLeave(log, "getEpochSegments", traceId, requestId);
});
}
Aggregations