add WriteBatch::WriteBatch(std::string&&)

Summary:
to save a string copy for some use cases.

The change is pretty straightforward, please feel free to let me know if you want to suggest any tests for it.
Closes https://github.com/facebook/rocksdb/pull/3349

Differential Revision: D6706828

Pulled By: yiwu-arbug

fbshipit-source-id: 873ce4442937bdc030b395c7f99228eda7f59eb7
main
Bo Liu 7 years ago committed by Facebook Github Bot
parent d4da02d147
commit 204af1eccc
  1. 6
      db/write_batch.cc
  2. 1
      include/rocksdb/write_batch.h

@ -144,6 +144,12 @@ WriteBatch::WriteBatch(const std::string& rep)
max_bytes_(0),
rep_(rep) {}
WriteBatch::WriteBatch(std::string&& rep)
: save_points_(nullptr),
content_flags_(ContentFlags::DEFERRED),
max_bytes_(0),
rep_(std::move(rep)) {}
WriteBatch::WriteBatch(const WriteBatch& src)
: save_points_(src.save_points_),
wal_term_point_(src.wal_term_point_),

@ -315,6 +315,7 @@ class WriteBatch : public WriteBatchBase {
// Constructor with a serialized string object
explicit WriteBatch(const std::string& rep);
explicit WriteBatch(std::string&& rep);
WriteBatch(const WriteBatch& src);
WriteBatch(WriteBatch&& src) noexcept;

Loading…
Cancel
Save