From a6f4f2d6aa3b76cbe61bb63a8a4f00971db8e7ae Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Sat, 7 Feb 2015 22:10:35 +0100 Subject: [PATCH] db: Add mutation_partition::tombstone_for_row() --- database.hh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/database.hh b/database.hh index 1093c372d6..b0edcfeac6 100644 --- a/database.hh +++ b/database.hh @@ -206,6 +206,27 @@ public: } return &i->second.cells; } + + /** + * Returns the base tombstone for all cells of given clustering row. Such tombstone + * holds all information necessary to decide whether cells in a row are deleted or not, + * in addition to any information inside individual cells. + */ + tombstone tombstone_for_row(schema_ptr schema, const clustering_key& key) { + tombstone t = _tombstone; + + auto i = _row_tombstones.lower_bound(key); + if (i != _row_tombstones.end() && schema->clustering_key_prefix_type->is_prefix_of(i->first, key)) { + t.apply(i->second); + } + + auto j = _rows.find(key); + if (j != _rows.end()) { + t.apply(j->second.t); + } + + return t; + } }; class mutation final {