Search in sources :

Example 6 with GetStreamSegmentInfo

use of io.pravega.shared.protocol.netty.WireCommands.GetStreamSegmentInfo in project pravega by pravega.

the class SegmentMetadataClientImpl method getStreamSegmentInfo.

@VisibleForTesting
CompletableFuture<StreamSegmentInfo> getStreamSegmentInfo() {
    log.debug("Getting segment info for segment: {}", segmentId);
    RawClient connection = getConnection();
    long requestId = connection.getFlow().getNextSequenceNumber();
    return tokenProvider.retrieveToken().thenCompose(token -> connection.sendRequest(requestId, new GetStreamSegmentInfo(requestId, segmentId.getScopedName(), token))).thenApply(r -> transformReply(r, StreamSegmentInfo.class));
}
Also used : SneakyThrows(lombok.SneakyThrows) TokenExpiredException(io.pravega.auth.TokenExpiredException) Retry(io.pravega.common.util.Retry) ConnectionFailedException(io.pravega.shared.protocol.netty.ConnectionFailedException) Reply(io.pravega.shared.protocol.netty.Reply) Exceptions(io.pravega.common.Exceptions) RequiredArgsConstructor(lombok.RequiredArgsConstructor) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) CompletableFuture(java.util.concurrent.CompletableFuture) GetSegmentAttribute(io.pravega.shared.protocol.netty.WireCommands.GetSegmentAttribute) GetStreamSegmentInfo(io.pravega.shared.protocol.netty.WireCommands.GetStreamSegmentInfo) RawClient(io.pravega.client.connection.impl.RawClient) UpdateSegmentAttribute(io.pravega.shared.protocol.netty.WireCommands.UpdateSegmentAttribute) AccessOperation(io.pravega.shared.security.auth.AccessOperation) TokenException(io.pravega.auth.TokenException) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) StreamSegmentInfo(io.pravega.shared.protocol.netty.WireCommands.StreamSegmentInfo) TruncateSegment(io.pravega.shared.protocol.netty.WireCommands.TruncateSegment) RetryWithBackoff(io.pravega.common.util.Retry.RetryWithBackoff) ConnectionPool(io.pravega.client.connection.impl.ConnectionPool) lombok.val(lombok.val) CompletionException(java.util.concurrent.CompletionException) DelegationTokenProviderFactory(io.pravega.client.security.auth.DelegationTokenProviderFactory) UUID(java.util.UUID) WireCommands(io.pravega.shared.protocol.netty.WireCommands) GuardedBy(javax.annotation.concurrent.GuardedBy) WrongHost(io.pravega.shared.protocol.netty.WireCommands.WrongHost) DelegationTokenProvider(io.pravega.client.security.auth.DelegationTokenProvider) SegmentAttributeUpdated(io.pravega.shared.protocol.netty.WireCommands.SegmentAttributeUpdated) Slf4j(lombok.extern.slf4j.Slf4j) InvalidTokenException(io.pravega.auth.InvalidTokenException) SegmentTruncated(io.pravega.shared.protocol.netty.WireCommands.SegmentTruncated) SealSegment(io.pravega.shared.protocol.netty.WireCommands.SealSegment) SegmentSealed(io.pravega.shared.protocol.netty.WireCommands.SegmentSealed) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ConnectionClosedException(io.pravega.client.stream.impl.ConnectionClosedException) Controller(io.pravega.client.control.impl.Controller) Futures(io.pravega.common.concurrent.Futures) GetStreamSegmentInfo(io.pravega.shared.protocol.netty.WireCommands.GetStreamSegmentInfo) GetStreamSegmentInfo(io.pravega.shared.protocol.netty.WireCommands.GetStreamSegmentInfo) StreamSegmentInfo(io.pravega.shared.protocol.netty.WireCommands.StreamSegmentInfo) RawClient(io.pravega.client.connection.impl.RawClient) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

GetStreamSegmentInfo (io.pravega.shared.protocol.netty.WireCommands.GetStreamSegmentInfo)6 StreamSegmentInfo (io.pravega.shared.protocol.netty.WireCommands.StreamSegmentInfo)6 lombok.val (lombok.val)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 TokenException (io.pravega.auth.TokenException)2 TokenExpiredException (io.pravega.auth.TokenExpiredException)2 Exceptions (io.pravega.common.Exceptions)2 Futures (io.pravega.common.concurrent.Futures)2 WireCommands (io.pravega.shared.protocol.netty.WireCommands)2 CreateSegment (io.pravega.shared.protocol.netty.WireCommands.CreateSegment)2 GetSegmentAttribute (io.pravega.shared.protocol.netty.WireCommands.GetSegmentAttribute)2 SealSegment (io.pravega.shared.protocol.netty.WireCommands.SealSegment)2 SegmentAttributeUpdated (io.pravega.shared.protocol.netty.WireCommands.SegmentAttributeUpdated)2 SegmentCreated (io.pravega.shared.protocol.netty.WireCommands.SegmentCreated)2 SegmentSealed (io.pravega.shared.protocol.netty.WireCommands.SegmentSealed)2 SegmentTruncated (io.pravega.shared.protocol.netty.WireCommands.SegmentTruncated)2 TruncateSegment (io.pravega.shared.protocol.netty.WireCommands.TruncateSegment)2 UpdateSegmentAttribute (io.pravega.shared.protocol.netty.WireCommands.UpdateSegmentAttribute)2 WrongHost (io.pravega.shared.protocol.netty.WireCommands.WrongHost)2 CompletableFuture (java.util.concurrent.CompletableFuture)2