use of io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_BETWEEN_STREAM_CUTS in project pravega by pravega.
the class ControllerServiceImpl method getSegmentsBetween.
@Override
public void getSegmentsBetween(Controller.StreamCutRange request, StreamObserver<Controller.StreamCutRangeResponse> responseObserver) {
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), GET_SEGMENTS_BETWEEN_STREAM_CUTS, request.getStreamInfo().getScope(), request.getStreamInfo().getStream());
log.info(requestTag.getRequestId(), "getSegmentsBetweenStreamCuts called for stream {} for cuts from {} to {}", request.getStreamInfo(), request.getFromMap(), request.getToMap());
String scope = request.getStreamInfo().getScope();
String stream = request.getStreamInfo().getStream();
authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorizationAndCreateToken(authorizationResource.ofStreamInScope(scope, stream), AuthHandler.Permissions.READ), delegationToken -> {
logIfEmpty(delegationToken, "getSegmentsBetween", request.getStreamInfo().getScope(), request.getStreamInfo().getStream());
return controllerService.getSegmentsBetweenStreamCuts(request, requestTag.getRequestId()).thenApply(segments -> ModelHelper.createStreamCutRangeResponse(scope, stream, segments.stream().map(x -> ModelHelper.createSegmentId(scope, stream, x.segmentId())).collect(Collectors.toList()), delegationToken));
}, responseObserver);
}
Aggregations