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



##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -33,41 +37,76 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
+import java.nio.channels.WritableByteChannel;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public class NettyServerStreamRpc implements DataStreamServerRpc {
   public static final Logger LOG = 
LoggerFactory.getLogger(NettyServerStreamRpc.class);
 
-  private RaftPeer raftServer;
-  private EventLoopGroup bossGroup = new NioEventLoopGroup();
-  private EventLoopGroup workerGroup = new NioEventLoopGroup();
-  private ChannelFuture channelFuture;
-  private RandomAccessFile stream;
-  private FileChannel fileChannel;
-  private File file = new File("client-data-stream");
+  private final RaftPeer raftServer;
+  private final EventLoopGroup bossGroup = new NioEventLoopGroup();
+  private final EventLoopGroup workerGroup = new NioEventLoopGroup();
+  private final ChannelFuture channelFuture;
 
+  private final StateMachine stateMachine;
+  private final ConcurrentMap<Long, CompletableFuture<DataStream>> streams = 
new ConcurrentHashMap<>();
 
-  public NettyServerStreamRpc(RaftPeer server){
+  public NettyServerStreamRpc(RaftPeer server, StateMachine stateMachine) {
     this.raftServer = server;
-    setupServer();
+    this.stateMachine = stateMachine;
+    this.channelFuture = buildChannel();
+  }
+
+  private CompletableFuture<DataStream> getDataStreamFuture(ByteBuf buf, 
AtomicBoolean released) {
+    try {
+      // TODO: read the request from buf

Review comment:
       Thanks.  Just have filed RATIS-1085.




----------------------------------------------------------------
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