amaliujia commented on a change in pull request #232:
URL: https://github.com/apache/incubator-ratis/pull/232#discussion_r512391838
##########
File path:
ratis-common/src/main/java/org/apache/ratis/protocol/DataStreamPacketHeader.java
##########
@@ -19,29 +19,17 @@
package org.apache.ratis.protocol;
import org.apache.ratis.datastream.impl.DataStreamPacketImpl;
+import org.apache.ratis.proto.RaftProtos.DataStreamPacketHeaderProto.Type;
import org.apache.ratis.util.SizeInBytes;
-import java.util.function.LongSupplier;
-
/** The header format is streamId, streamOffset, dataLength. */
public class DataStreamPacketHeader extends DataStreamPacketImpl {
- private static final SizeInBytes SIZE = SizeInBytes.valueOf(24);
-
- public static int getSize() {
- return SIZE.getSizeInt();
- }
-
- public static DataStreamPacketHeader read(LongSupplier readLong, int
readableBytes) {
- if (readableBytes < getSize()) {
- return null;
- }
- return new DataStreamPacketHeader(readLong.getAsLong(),
readLong.getAsLong(), readLong.getAsLong());
- }
+ private static final SizeInBytes SIZE_OF_HEADER_LEN = SizeInBytes.valueOf(4);
Review comment:
why header size is 4 now?
##########
File path: ratis-proto/src/main/proto/Raft.proto
##########
@@ -279,6 +279,30 @@ message RaftClientRequestProto {
}
}
+message DataStreamPacketHeaderProto {
+ enum Type {
+ STREAM_HEADER = 0;
+ STREAM_DATA = 1;
+ STREAM_CLOSE = 2;
+ START_TRANSACTION = 3;
+ }
+
+ uint64 streamId = 1;
+ uint64 streamOffset = 2;
+ Type type = 3;
+ uint64 dataLength = 4;
+}
+
+message DataStreamRequestHeaderProto {
+ DataStreamPacketHeaderProto packetHeader = 1;
+}
+
+message DataStreamReplyHeaderProto {
+ DataStreamPacketHeaderProto packetHeader = 1;
+ uint64 bytesWritten = 2;
+ bool success = 3;
Review comment:
`isSuccess`?
----------------------------------------------------------------
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]