From cc4e2ec622fa3a6a6b011e2f4920d2907961851d Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Thu, 7 May 2015 10:29:09 +0200 Subject: [PATCH] mutation_partition: Add r-value variant of clustered_row() --- mutation_partition.cc | 11 +++++++++++ mutation_partition.hh | 1 + 2 files changed, 12 insertions(+) diff --git a/mutation_partition.cc b/mutation_partition.cc index 319afdd2fb..93ca086b66 100644 --- a/mutation_partition.cc +++ b/mutation_partition.cc @@ -161,6 +161,17 @@ mutation_partition::find_row(const clustering_key& key) const { return &i->row().cells; } +deletable_row& +mutation_partition::clustered_row(clustering_key&& key) { + auto i = _rows.find(key); + if (i == _rows.end()) { + auto e = new rows_entry(std::move(key)); + _rows.insert(i, *e); + return e->row(); + } + return i->row(); +} + deletable_row& mutation_partition::clustered_row(const clustering_key& key) { auto i = _rows.find(key); diff --git a/mutation_partition.hh b/mutation_partition.hh index ff230d9904..72275077f5 100644 --- a/mutation_partition.hh +++ b/mutation_partition.hh @@ -205,6 +205,7 @@ public: const row& static_row() const { return _static_row; } const row_tombstones_type& row_tombstones() const { return _row_tombstones; } deletable_row& clustered_row(const clustering_key& key); + deletable_row& clustered_row(clustering_key&& key); deletable_row& clustered_row(const schema& s, const clustering_key_view& key); const row* find_row(const clustering_key& key) const; const rows_entry* find_entry(schema_ptr schema, const clustering_key_prefix& key) const;