use of io.pravega.shared.protocol.netty.WireCommands.TYPE_PLUS_LENGTH_SIZE in project pravega by pravega.
the class PravegaRequestProcessor method readSegment.
// endregion
// region RequestProcessor Implementation
@Override
public void readSegment(ReadSegment readSegment) {
Timer timer = new Timer();
final String segment = readSegment.getSegment();
final String operation = "readSegment";
if (!verifyToken(segment, readSegment.getOffset(), readSegment.getDelegationToken(), operation)) {
return;
}
final int readSize = min(MAX_READ_SIZE, max(TYPE_PLUS_LENGTH_SIZE, readSegment.getSuggestedLength()));
long trace = LoggerHelpers.traceEnter(log, operation, readSegment);
segmentStore.read(segment, readSegment.getOffset(), readSize, TIMEOUT).thenAccept(readResult -> {
LoggerHelpers.traceLeave(log, operation, trace, readResult);
handleReadResult(readSegment, readResult);
this.statsRecorder.readComplete(timer.getElapsed());
}).exceptionally(ex -> handleException(readSegment.getRequestId(), segment, readSegment.getOffset(), operation, wrapCancellationException(ex)));
}
Aggregations