afterincomparableyum commented on code in PR #3611:
URL: https://github.com/apache/celeborn/pull/3611#discussion_r3007594658
##########
cpp/celeborn/protocol/Encoders.cpp:
##########
@@ -33,5 +34,70 @@ std::string decode(memory::ReadOnlyByteBuffer& buffer) {
int size = buffer.read<int>();
return buffer.readToString(size);
}
+
+int encodedLength(const std::vector<std::string>& arr) {
+ int total = sizeof(int);
+ for (const auto& s : arr) {
+ total += encodedLength(s);
+ }
+ return total;
+}
+
+void encode(
+ memory::WriteOnlyByteBuffer& buffer,
+ const std::vector<std::string>& arr) {
+ buffer.write<int>(static_cast<int>(arr.size()));
+ for (const auto& s : arr) {
+ encode(buffer, s);
+ }
Review Comment:
I can add this check.
--
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]