szetszwo commented on code in PR #716:
URL: https://github.com/apache/ratis/pull/716#discussion_r977108228
##########
ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java:
##########
@@ -37,7 +39,20 @@ public interface DataStreamOutput extends
CloseAsync<DataStreamReply> {
* @param options - options specifying how the data was written
* @return a future of the reply.
*/
- CompletableFuture<DataStreamReply> writeAsync(ByteBuffer src, WriteOption...
options);
+ default CompletableFuture<DataStreamReply> writeAsync(ByteBuffer src,
+ WriteOption... options) {
Review Comment:
Please use a single line. This line width in Ratis is 120.
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -153,12 +160,17 @@ private CompletableFuture<DataStreamReply>
writeAsyncImpl(Object data, long leng
@Override
public CompletableFuture<DataStreamReply> writeAsync(ByteBuffer src,
WriteOption... options) {
+ return writeAsync(src,
Arrays.stream(options).collect(Collectors.toList()));
Review Comment:
Use `Arrays.asList(options)`.
##########
ratis-common/src/main/java/org/apache/ratis/datastream/impl/DataStreamRequestByteBuffer.java:
##########
@@ -41,6 +41,7 @@ public DataStreamRequestByteBuffer(DataStreamRequestHeader
header, ByteBuffer bu
@Override
@SuppressFBWarnings("EI_EXPOSE_REP")
+ @Deprecated
Review Comment:
Change options to `List<WriteOption>` and remove this method.
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedStreamAsync.java:
##########
@@ -149,7 +149,8 @@ private void sendRequestToNetwork(DataStreamWindowRequest
request,
request.getDataStreamRequest());
long seqNum = request.getSeqNum();
- final boolean isClose =
StandardWriteOption.CLOSE.isOneOf(request.getDataStreamRequest().getWriteOptions());
+ final boolean isClose =
+
StandardWriteOption.CLOSE.isOneOf(request.getDataStreamRequest().getWriteOptionsList());
Review Comment:
Please use a single line. This line width in Ratis is 120.
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -123,10 +126,12 @@ private DataStreamOutputImpl(RaftClientRequest request) {
this.header = request;
this.slidingWindow = new
SlidingWindow.Client<>(ClientInvocationId.valueOf(clientId,
header.getCallId()));
final ByteBuffer buffer =
ClientProtoUtils.toRaftClientRequestProtoByteBuffer(header);
- this.headerFuture = send(Type.STREAM_HEADER, buffer, buffer.remaining());
+ this.headerFuture = send(Type.STREAM_HEADER, buffer, buffer.remaining(),
+ Collections.EMPTY_LIST);
Review Comment:
Use `Collections.emptyList()`; otherwise, there is a unchecked assignment
warning.
```java
this.headerFuture = send(Type.STREAM_HEADER, buffer,
buffer.remaining(), Collections.emptyList());
```
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -123,10 +126,12 @@ private DataStreamOutputImpl(RaftClientRequest request) {
this.header = request;
this.slidingWindow = new
SlidingWindow.Client<>(ClientInvocationId.valueOf(clientId,
header.getCallId()));
final ByteBuffer buffer =
ClientProtoUtils.toRaftClientRequestProtoByteBuffer(header);
- this.headerFuture = send(Type.STREAM_HEADER, buffer, buffer.remaining());
+ this.headerFuture = send(Type.STREAM_HEADER, buffer, buffer.remaining(),
+ Collections.EMPTY_LIST);
}
-
- private CompletableFuture<DataStreamReply> send(Type type, Object data,
long length, WriteOption... options) {
+ private CompletableFuture<DataStreamReply> send(Type type, Object data,
+ long length,
+ Iterable<WriteOption>
options) {
Review Comment:
Please use a single line. This line width in Ratis is 120.
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -136,7 +141,9 @@ private CompletableFuture<DataStreamReply>
combineHeader(CompletableFuture<DataS
return future.thenCombine(headerFuture, (reply, headerReply) ->
headerReply.isSuccess()? reply : headerReply);
}
- private CompletableFuture<DataStreamReply> writeAsyncImpl(Object data,
long length, WriteOption... options) {
+ private CompletableFuture<DataStreamReply> writeAsyncImpl(Object data,
+ long length,
+ Iterable<WriteOption> options) {
Review Comment:
Please use a single line. This line width in Ratis is 120.
##########
ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java:
##########
@@ -37,7 +39,20 @@ public interface DataStreamOutput extends
CloseAsync<DataStreamReply> {
* @param options - options specifying how the data was written
* @return a future of the reply.
*/
- CompletableFuture<DataStreamReply> writeAsync(ByteBuffer src, WriteOption...
options);
+ default CompletableFuture<DataStreamReply> writeAsync(ByteBuffer src,
+ WriteOption... options) {
+ return writeAsync(src, Arrays.asList(options));
+ }
+
+ /**
+ * Send out the data in the source buffer asynchronously.
+ *
+ * @param src the source buffer to be sent.
+ * @param options - options specifying how the data was written
+ * @return a future of the reply.
+ */
+ CompletableFuture<DataStreamReply> writeAsync(ByteBuffer src,
+ Iterable<WriteOption> options);
Review Comment:
Please use a single line. This line width in Ratis is 120.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]