wwbmmm commented on code in PR #3062:
URL: https://github.com/apache/brpc/pull/3062#discussion_r2268566526


##########
src/butil/iobuf.cpp:
##########
@@ -1976,6 +1976,259 @@ size_t IOBufCutter::cutn(void* out, size_t n) {
     }
 }
 
+SingleIOBuf::SingleIOBuf()

Review Comment:
   maybe move these code to a seperate single_iobuf.cpp and single_iobuf.h, 
this file is too long



##########
src/butil/iobuf.h:
##########
@@ -545,6 +547,47 @@ class IOBufCutter {
     IOBuf* _buf;
 };
 
+// SingleIOBuf is a lightweight buffer that manages a single IOBuf::Block.
+// It always ensures that the underlying memory is contiguous and 
+// avoids unnecessary memory copies through.
+// It is primarily used to efficiently serialize and deserialize 
+// RPC requests in flatbuffers.
+class SingleIOBuf {
+public:
+    SingleIOBuf();
+    ~SingleIOBuf();
+    SingleIOBuf(const IOBuf::BlockRef& ref);
+    SingleIOBuf(const SingleIOBuf& other);
+    SingleIOBuf& operator=(const SingleIOBuf& rhs);
+    void* alloc(uint32_t size);

Review Comment:
   better add some comment to explain the function of each 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.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to