Search in sources :

Example 41 with DelegationToken

use of io.pravega.controller.stream.api.grpc.v1.Controller.DelegationToken in project pravega by pravega.

the class ControllerServiceImpl method updateSubscriberStreamCut.

@Override
public void updateSubscriberStreamCut(SubscriberStreamCut request, StreamObserver<UpdateSubscriberStatus> responseObserver) {
    String scope = request.getStreamCut().getStreamInfo().getScope();
    String stream = request.getStreamCut().getStreamInfo().getStream();
    String subscriber = request.getSubscriber();
    String readerGroupId = request.getReaderGroupId();
    long generation = request.getGeneration();
    StreamCut streamCut = request.getStreamCut();
    RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), UPDATE_TRUNCATION_STREAM_CUT, scope, stream);
    log.info(requestTag.getRequestId(), "updateSubscriberStreamCut called for stream {}/{}.", scope, stream);
    authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorization(authorizationResource.ofStreamInScope(scope, stream), AuthHandler.Permissions.READ_UPDATE), delegationToken -> controllerService.updateSubscriberStreamCut(scope, stream, subscriber, readerGroupId, generation, ImmutableMap.copyOf(ModelHelper.encode(streamCut)), requestTag.getRequestId()), responseObserver, requestTag);
}
Also used : StreamCut(io.pravega.controller.stream.api.grpc.v1.Controller.StreamCut) SubscriberStreamCut(io.pravega.controller.stream.api.grpc.v1.Controller.SubscriberStreamCut) RequestTag(io.pravega.common.tracing.RequestTag)

Aggregations

Controller (io.pravega.controller.stream.api.grpc.v1.Controller)37 CompletableFuture (java.util.concurrent.CompletableFuture)29 WireCommandType (io.pravega.shared.protocol.netty.WireCommandType)23 UUID (java.util.UUID)22 VisibleForTesting (com.google.common.annotations.VisibleForTesting)21 ImmutableMap (com.google.common.collect.ImmutableMap)21 ModelHelper (io.pravega.client.control.impl.ModelHelper)21 Exceptions (io.pravega.common.Exceptions)21 TagLogger (io.pravega.common.tracing.TagLogger)21 TxnStatus (io.pravega.controller.stream.api.grpc.v1.Controller.TxnStatus)21 List (java.util.List)21 CompletionException (java.util.concurrent.CompletionException)21 TimeoutException (java.util.concurrent.TimeoutException)21 Collectors (java.util.stream.Collectors)21 LoggerFactory (org.slf4j.LoggerFactory)21 WireCommands (io.pravega.shared.protocol.netty.WireCommands)20 AuthenticationException (io.pravega.auth.AuthenticationException)19 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)19 Pair (org.apache.commons.lang3.tuple.Pair)19 RequestTag (io.pravega.common.tracing.RequestTag)16