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



##########
File path: 
ratis-client/src/main/java/org/apache/ratis/client/ClientStreamApi.java
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.client;
+
+import org.apache.ratis.datastream.objects.DataStreamReply;
+import org.apache.ratis.datastream.objects.DataStreamRequest;
+import org.apache.ratis.util.JavaUtils;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * An api interface for to stream from client to server.
+ */
+public interface ClientStreamApi {

Review comment:
       Let's call this RaftClientStream so that it is consistent with 
RaftClientRpc.

##########
File path: 
ratis-common/src/main/java/org/apache/ratis/datastream/OutboundDataStream.java
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.datastream;
+
+import org.apache.ratis.datastream.objects.DataStreamReply;
+import java.nio.ByteBuffer;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+
+public interface OutboundDataStream extends AutoCloseable {

Review comment:
       Let's call this RaftDataOutputStream.

##########
File path: 
ratis-common/src/main/java/org/apache/ratis/datastream/DataStreamApi.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.datastream;
+
+import org.apache.ratis.datastream.objects.DataStreamReply;
+import org.apache.ratis.util.SizeInBytes;
+
+import java.nio.ByteBuffer;
+import java.util.concurrent.CompletableFuture;
+
+
+/**
+ * An interface for streaming data.
+ * Associated with it's implementation will be a client.
+ */
+
+public interface DataStreamApi {
+
+  /**
+   * Create a new stream for a new streamToRatis invocation
+   * allows multiple stream from a single client.
+   */
+  OutboundDataStream newStream();
+
+  /**
+   * stream large files to raft group from client.
+   * Returns a future of the final stream packet to indicate completion of 
stream.
+   * Bytebuffer needs to be direct for zero-copy semantics.
+   *
+   */
+  CompletableFuture<DataStreamReply> streamToRatis(ByteBuffer message, 
SizeInBytes packetSize);

Review comment:
       Let's skip these two streamToRatis methods for the moment so that we can 
focus on implementing only the newStream() method.




----------------------------------------------------------------
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:
[email protected]


Reply via email to