sstable: Add consumer_m::consume_row_marker_and_tombstone

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
This commit is contained in:
Piotr Jastrzebski
2018-06-18 20:28:02 +02:00
parent 4c261d2e51
commit cbfc741d70
3 changed files with 18 additions and 5 deletions

View File

@@ -35,6 +35,11 @@ class liveness_info {
api::timestamp_type _timestamp;
gc_clock::duration _ttl;
gc_clock::time_point _local_deletion_time;
bool is_set() const {
return _timestamp != api::missing_timestamp
|| _ttl != gc_clock::duration::zero()
|| _local_deletion_time != gc_clock::time_point::max();
}
public:
explicit liveness_info(const serialization_header& header)
: _header(header)
@@ -56,12 +61,10 @@ public:
api::timestamp_type timestamp() const { return _timestamp; }
gc_clock::duration ttl() const { return _ttl; }
gc_clock::time_point local_deletion_time() const { return _local_deletion_time; }
bool is_set() const {
return _timestamp != api::missing_timestamp
|| _ttl != gc_clock::duration::zero()
|| _local_deletion_time != gc_clock::time_point::max();
}
row_marker to_row_marker() const {
if (!is_set()) {
return row_marker();
}
return _ttl != gc_clock::duration::zero() || _local_deletion_time != gc_clock::time_point::max()
? row_marker(_timestamp, _ttl, _local_deletion_time)
: row_marker(_timestamp);

View File

@@ -31,6 +31,7 @@
#include "row.hh"
#include "clustering_ranges_walker.hh"
#include "utils/data_input.hh"
#include "liveness_info.hh"
namespace sstables {
@@ -931,6 +932,12 @@ public:
return proceed::yes;
}
virtual proceed consume_row_marker_and_tombstone(const liveness_info& info, tombstone t) override {
_in_progress_row.apply(t);
_in_progress_row.apply(info.to_row_marker());
return proceed::yes;
}
virtual proceed consume_static_row_start() override {
_inside_static_row = true;
_in_progress_static_row = static_row();

View File

@@ -41,6 +41,7 @@
#include "column_translation.hh"
#include "sstables.hh"
#include "tombstone.hh"
// sstables::data_consume_row feeds the contents of a single row into a
// row_consumer object:
@@ -154,6 +155,8 @@ public:
virtual proceed consume_row_start(const std::vector<temporary_buffer<char>>& ecp) = 0;
virtual proceed consume_row_marker_and_tombstone(const sstables::liveness_info& info, tombstone t) = 0;
virtual proceed consume_static_row_start() = 0;
virtual proceed consume_column(stdx::optional<column_id> column_id,