diff --git a/db/commitlog/commitlog_entry.cc b/db/commitlog/commitlog_entry.cc index e2326dd9f1..4cd68a95f4 100644 --- a/db/commitlog/commitlog_entry.cc +++ b/db/commitlog/commitlog_entry.cc @@ -44,6 +44,22 @@ commitlog_entry::commitlog_entry(stdx::optional mapping, const f , _mutation(mutation) { } +commitlog_entry::commitlog_entry(commitlog_entry&& ce) + : _mapping(std::move(ce._mapping)) + , _mutation_storage(std::move(ce._mutation_storage)) + , _mutation(_mutation_storage ? *_mutation_storage : ce._mutation) +{ +} + +commitlog_entry& commitlog_entry::operator=(commitlog_entry&& ce) +{ + if (this != &ce) { + this->~commitlog_entry(); + new (this) commitlog_entry(std::move(ce)); + } + return *this; +} + commitlog_entry commitlog_entry_writer::get_entry() const { if (_with_schema) { return commitlog_entry(_schema->get_column_mapping(), _mutation); diff --git a/db/commitlog/commitlog_entry.hh b/db/commitlog/commitlog_entry.hh index 508f4ec3d5..51eaf482a9 100644 --- a/db/commitlog/commitlog_entry.hh +++ b/db/commitlog/commitlog_entry.hh @@ -35,6 +35,10 @@ class commitlog_entry { public: commitlog_entry(stdx::optional mapping, frozen_mutation&& mutation); commitlog_entry(stdx::optional mapping, const frozen_mutation& mutation); + commitlog_entry(commitlog_entry&&); + commitlog_entry(const commitlog_entry&) = delete; + commitlog_entry& operator=(commitlog_entry&&); + commitlog_entry& operator=(const commitlog_entry&) = delete; const stdx::optional& mapping() const { return _mapping; } const frozen_mutation& mutation() const { return _mutation; } };