peterxcli commented on PR #1653: URL: https://github.com/apache/ratis/pull/1653#issuecomment-6334081626
> Take one step further: > > I think we need an enhanced API that do not expose a closeable channel. We only need to offer a wrapper of a channel that expose ` public int write(ByteBuffer src) throws IOException`. > > The contract between Ratis and the application is either 1) return normally when done 2) or throw proper exceptions. Then both Ratis and applicatiosn do not need to worry about when to close the channel or if channel is closed already. Applications focus on writes and throws. Ratis cares about stream close/fail and crafts proper responses to the clients. +1 https://github.com/apache/ratis/blob/99e135afbaa361e96d1f3d3e94b4e122e72fdbbe/ratis-server-api/src/main/java/org/apache/ratis/server/api/DataStreamApi.java#L26-L29 typically when using `java.nio.channels.FileChannel#transferTo(long, long, WritableByteChannel)` we mange the WritableByteChannel as destination in application, but in ratis, the destination is agonistic to server writing data stream response, so manage the lifecycle in ratis(ReadStreamManagement) make more sense and much straigh-forward for users. -- 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]
