use of org.apache.ratis.proto.ExamplesProtos.ReadRequestProto in project incubator-ratis by apache.
the class FileStoreStateMachine method query.
@Override
public CompletableFuture<Message> query(Message request) {
final ReadRequestProto proto;
try {
proto = ReadRequestProto.parseFrom(request.getContent());
} catch (InvalidProtocolBufferException e) {
return FileStoreCommon.completeExceptionally("Failed to parse " + request, e);
}
final String path = proto.getPath().toStringUtf8();
return files.read(path, proto.getOffset(), proto.getLength(), true).thenApply(reply -> Message.valueOf(reply.toByteString()));
}
Aggregations