use of io.pravega.shared.protocol.netty.WireCommands.TruncateSegment in project pravega by pravega.
the class PravegaRequestProcessor method truncateSegment.
@Override
public void truncateSegment(TruncateSegment truncateSegment) {
String segment = truncateSegment.getSegment();
if (!verifyToken(segment, truncateSegment.getRequestId(), truncateSegment.getDelegationToken(), READ_UPDATE, "Truncate Segment")) {
return;
}
long offset = truncateSegment.getTruncationOffset();
log.debug("Truncating segment {} at offset {} ", segment, offset);
segmentStore.truncateStreamSegment(segment, offset, TIMEOUT).thenAccept(v -> connection.send(new SegmentTruncated(truncateSegment.getRequestId(), segment))).exceptionally(e -> handleException(truncateSegment.getRequestId(), segment, "Truncate segment", e));
}
use of io.pravega.shared.protocol.netty.WireCommands.TruncateSegment in project pravega by pravega.
the class SegmentMetadataClientImpl method truncateSegmentAsync.
private CompletableFuture<SegmentTruncated> truncateSegmentAsync(Segment segment, long offset, String delegationToken) {
long requestId = requestIdGenerator.get();
log.trace("Truncating segment: {}", segment);
RawClient connection = getConnection();
return connection.sendRequest(requestId, new TruncateSegment(requestId, segment.getScopedName(), offset, delegationToken)).thenApply(r -> transformReply(r, SegmentTruncated.class));
}
Aggregations