AntiTopQuark commented on code in PR #2277:
URL: https://github.com/apache/kvrocks/pull/2277#discussion_r1582955319


##########
src/storage/rdb.cc:
##########
@@ -1005,3 +1000,35 @@ Status RDB::rdbSaveBinaryDoubleValue(double val) {
   memrev64ifbe(&val);
   return stream_->Write((const char *)(&val), sizeof(val));
 }
+
+Status RDB::rdbSaveZipListObject(const std::string &elem) {
+  // calc total ziplist size
+  uint prevlen = 0;
+  const size_t ziplist_size = zlHeaderSize + zlEndSize + elem.length() +
+                              ZipList::ZipStorePrevEntryLength(nullptr, 
prevlen) +
+                              ZipList::ZipStoreEntryEncoding(nullptr, 
elem.length());
+  auto zl_string = std::string(ziplist_size, 0);
+  auto zl_ptr = reinterpret_cast<unsigned char *>(&zl_string[0]);
+
+  // set ziplist header
+  ZipList::SetZipListBytes(zl_ptr, intrev32ifbe(ziplist_size));

Review Comment:
   done



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

Reply via email to