You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/11/18 03:19:50 UTC

[GitHub] [incubator-ratis] szetszwo commented on a change in pull request #284: RATIS-1154. Add sync flag when write stream data

szetszwo commented on a change in pull request #284:
URL: https://github.com/apache/incubator-ratis/pull/284#discussion_r525715378



##########
File path: ratis-test/src/test/java/org/apache/ratis/datastream/DataStreamBaseTest.java
##########
@@ -105,8 +106,14 @@ SingleDataStream getSingleDataStream(long callId) {
   static class SingleDataStream implements DataStream {
     private int byteWritten = 0;
     private final RaftClientRequest writeRequest;
+    private boolean isForced = false;

Review comment:
       Let's recorded the forced position.
   ```
   int forcedPosition = 0;
   ```

##########
File path: ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java
##########
@@ -26,5 +26,5 @@
 /** An asynchronous output stream supporting zero buffer copying. */
 public interface DataStreamOutput extends CloseAsync<DataStreamReply> {
   /** Send out the data in the buffer asynchronously */
-  CompletableFuture<DataStreamReply> writeAsync(ByteBuffer buf);
+  CompletableFuture<DataStreamReply> writeAsync(ByteBuffer buf, boolean sync);

Review comment:
       We should add one more method
   ```suggestion
     default CompletableFuture<DataStreamReply> writeAsync(ByteBuffer buffer) {
       return writeAsync(buffer, false);
     }
   
     CompletableFuture<DataStreamReply> writeAsync(ByteBuffer buffer, boolean sync);
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org