in ratis-logservice/src/main/java/org/apache/ratis/logservice/impl/LogReaderImpl.java [106:129]
public void readNext(ByteBuffer buffer) throws IOException {
Preconditions.checkNotNull(buffer, "buffer is NULL" );
try {
RaftClientReply reply = raftClient.io().sendReadOnly(Message.valueOf(LogServiceProtoUtil
.toReadLogRequestProto(parent.getName(), currentRecordId, 1).toByteString()));
if (reply.getException() != null) {
throw new IOException(reply.getException());
}
ReadLogReplyProto proto = ReadLogReplyProto.parseFrom(reply.getMessage().getContent());
if (proto.hasException()) {
LogServiceException e = proto.getException();
throw new IOException(e.getErrorMsg());
}
currentRecordId++;
if (proto.getLogRecordCount() > 0) {
// TODO limits
buffer.put(proto.getLogRecord(0).toByteArray());
}
} catch (Exception e) {
throw new IOException(e);
}
}