use of io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_TRANSACTION in project pravega by pravega.
the class ControllerServiceImpl method createTransaction.
@Override
public void createTransaction(CreateTxnRequest request, StreamObserver<Controller.CreateTxnResponse> responseObserver) {
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), CREATE_TRANSACTION, request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), Long.toString(request.getLease()));
log.info(requestTag.getRequestId(), "createTransaction called for stream {}/{}.", request.getStreamInfo().getScope(), request.getStreamInfo().getStream());
authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorizationAndCreateToken(authorizationResource.ofStreamInScope(request.getStreamInfo().getScope(), request.getStreamInfo().getStream()), AuthHandler.Permissions.READ_UPDATE), delegationToken -> controllerService.createTransaction(request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), request.getLease(), requestTag.getRequestId()).thenApply(pair -> Controller.CreateTxnResponse.newBuilder().setDelegationToken(delegationToken).setTxnId(decode(pair.getKey())).addAllActiveSegments(pair.getValue()).build()), responseObserver, requestTag);
}
Aggregations