use of org.apache.ratis.proto.ExamplesProtos.ReadReplyProto in project incubator-ratis by apache.
the class FileStore method read.
CompletableFuture<ReadReplyProto> read(String relative, long offset, long length, boolean readCommitted) {
final Supplier<String> name = () -> "read(" + relative + ", " + offset + ", " + length + ") @" + getId();
final CheckedSupplier<ReadReplyProto, IOException> task = LogUtils.newCheckedSupplier(LOG, () -> {
final FileInfo info = files.get(relative);
final ReadReplyProto.Builder reply = ReadReplyProto.newBuilder().setResolvedPath(FileStoreCommon.toByteString(info.getRelativePath())).setOffset(offset);
final ByteString bytes = info.read(this::resolve, offset, length, readCommitted);
return reply.setData(bytes).build();
}, name);
return submit(task, reader);
}
Aggregations