Github user joshelser commented on a diff in the pull request:
https://github.com/apache/incubator-ratis/pull/4#discussion_r212077861
--- Diff:
ratis-logservice/src/main/java/org/apache/ratis/logservice/api/AsyncLogReader.java
---
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ratis.logservice.api;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Asynchronous client interface to read from a LogStream.
+ */
+public interface AsyncLogReader extends AutoCloseable {
+
+ /**
+ * Seeks to the position before the record at the provided {@code
recordId} in the LogStream.
+ *
+ * @param recordId A non-negative, recordId in the LogStream
+ * @return A future for when the operation is completed.
+ */
+ CompletableFuture<Void> seek(long recordId) throws IOException;
+
+ /**
+ * Reads the next record from the LogStream at the current position and
advances the current position
+ * to after the record which was just returned.
+ *
+ * @return A future providing the data for the next record.
+ */
+ CompletableFuture<ByteBuffer> readNext() throws IOException;
+
+ /**
+ * Reads the next {@code numRecords} records from the LogStream,
starting at the current position. This method
+ * may return fewer than requested records if the LogStream does not
have sufficient records to return.
+ *
+ * @param numRecords The number of records to return
+ * @return A future providing the records, no more than the requested
{@code numRecords} amount.
+ */
+ CompletableFuture<List<ByteBuffer>> readBulk(int numRecords) throws
IOException;
--- End diff --
@VladRodionov given your suggestion to have a `readNext(ByteBuffer)`
variant, do you think that we should have a similar addition for `readBulk`,
e.g. `readBulk(List<ByteBuffer>)` where we fill each provided ByteBuffer with
the next record? For example, if the caller gave a `List<ByteBuffer>` of length
5, we would return back 5 records.
---