mutation_partition: Allow row lookup by clustering_key_view

This commit is contained in:
Tomasz Grabiec
2015-05-06 09:40:25 +02:00
parent 96bbac8a57
commit 0aef6f2ff7
2 changed files with 17 additions and 0 deletions

View File

@@ -172,6 +172,16 @@ mutation_partition::clustered_row(const clustering_key& key) {
return i->row();
}
deletable_row&
mutation_partition::clustered_row(const schema& s, const clustering_key_view& key) {
auto i = _rows.find(key, rows_entry::compare(s));
if (i == _rows.end()) {
auto e = new rows_entry(key);
_rows.insert(i, *e);
return e->row();
}
return i->row();
}
boost::iterator_range<mutation_partition::rows_type::const_iterator>
mutation_partition::range(const schema& schema, const query::range<clustering_key_prefix>& r) const {

View File

@@ -129,6 +129,12 @@ public:
bool operator()(const rows_entry& e, const clustering_key& key) const {
return _c(e._key, key);
}
bool operator()(const clustering_key_view& key, const rows_entry& e) const {
return _c(key, e._key);
}
bool operator()(const rows_entry& e, const clustering_key_view& key) const {
return _c(e._key, key);
}
};
template <typename Comparator>
struct delegating_compare {
@@ -192,6 +198,7 @@ public:
const rows_type& clustered_rows() const { return _rows; }
const row& static_row() const { return _static_row; }
deletable_row& clustered_row(const 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;
tombstone range_tombstone_for_row(const schema& schema, const clustering_key& key) const;