runzhiwang commented on a change in pull request #232:
URL: https://github.com/apache/incubator-ratis/pull/232#discussion_r512392787



##########
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:
       It's not header size, it's size of header size. For example, if header 
size is 24, we only need an int to store 24, and the size of int is 4.




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