Files
scylladb/mutation/range_tombstone_splitter.hh
Andrzej Jackowski f8156702de tree: add missing -present to copyright headers
~2076 files used "Copyright (C) YYYY-present ScyllaDB" while
~88 files used "Copyright (C) YYYY ScyllaDB". This
inconsistency leads to unnecessary code review discussions
and gradual spread of the less common format.

Standardize all ScyllaDB copyright headers to use -present.

Fixes SCYLLADB-1984

Closes scylladb/scylladb#29876
2026-05-21 10:57:42 +02:00

42 lines
1.2 KiB
C++

/*
* Copyright (C) 2021-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
*/
#pragma once
#include "keys/clustering_ranges_walker.hh"
#include "mutation/mutation_fragment.hh"
template<typename T>
concept SplitterFragmentConsumer = std::invocable<T, mutation_fragment>;
/// Takes a stream of range tombstone fragments and trims them to the boundaries of clustering key restrictions.
class range_tombstone_splitter {
clustering_ranges_walker& _walker;
range_tombstone_stream _rts;
public:
range_tombstone_splitter(const schema& s, reader_permit permit, clustering_ranges_walker& w)
: _walker(w)
, _rts(s, std::move(permit))
{ }
template<SplitterFragmentConsumer C>
void flush(position_in_partition_view pos, C consumer) {
while (auto rto = _rts.get_next(pos)) {
consumer(std::move(*rto));
}
}
template<SplitterFragmentConsumer C>
void consume(range_tombstone rt, C consumer) {
if (auto rto = _walker.split_tombstone(std::move(rt), _rts)) {
_rts.apply(std::move(*rto));
}
flush(rt.position(), std::move(consumer));
}
};