diff --git a/sstables/key.cc b/sstables/key.cc index dbdd631e14..3ac5a71437 100644 --- a/sstables/key.cc +++ b/sstables/key.cc @@ -151,29 +151,6 @@ key::to_partition_key(const schema& s) { return partition_key::from_exploded(s, explode(s)); } -template -composite composite::from_clustering_element(const schema& s, const ClusteringElement& ce) { - return from_components(ce.begin(s), ce.end(s), sstable_serializer()); -} - -template composite composite::from_clustering_element(const schema& s, const clustering_key_prefix& ck); - -composite composite::from_exploded(const std::vector& v, composite_marker m) { - if (v.size() == 0) { - return bytes(size_t(1), bytes::value_type(m)); - } - auto b = from_components(v.begin(), v.end(), sstable_serializer()); - b.back() = bytes::value_type(m); - return composite(std::move(b)); -} - -composite composite::static_prefix(const schema& s) { - static bytes static_marker(size_t(2), bytes::value_type(0xff)); - - std::vector sv(s.clustering_key_size()); - return static_marker + from_components(sv.begin(), sv.end(), sstable_serializer()); -} - inline std::vector explode_composite(bytes_view _bytes) { std::vector ret; @@ -208,10 +185,6 @@ std::vector key_view::explode(const schema& s) const { return explode_composite(_bytes); } -std::vector composite_view::explode() const { - return explode_composite(_bytes); -} - int key_view::tri_compare(const schema& s, partition_key_view other) const { auto lf = other.legacy_form(s); return lexicographical_tri_compare( diff --git a/sstables/key.hh b/sstables/key.hh index 9d6564c124..25904058b9 100644 --- a/sstables/key.hh +++ b/sstables/key.hh @@ -111,36 +111,4 @@ inline key maximum_key() { return key(key::kind::after_all_keys); }; -class composite_view { - bytes_view _bytes; -public: - composite_view(bytes_view b) : _bytes(b) {} - - std::vector explode() const; - - explicit operator bytes_view() const { - return _bytes; - } -}; - -class composite { - bytes _bytes; -public: - composite (bytes&& b) : _bytes(std::move(b)) {} - template - auto describe_type(Describer f) const { return f(const_cast(_bytes)); } - - static composite from_bytes(bytes b) { return composite(std::move(b)); } - template - static composite from_clustering_element(const schema& s, const ClusteringElement& ce); - static composite from_exploded(const std::vector& v, composite_marker m = composite_marker::none); - static composite static_prefix(const schema& s); - size_t size() const { return _bytes.size(); } - explicit operator bytes_view() const { - return _bytes; - } - operator composite_view() const { - return composite_view(_bytes); - } -}; } diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 499e263bd0..93f91b87c2 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -1068,14 +1068,14 @@ future<> sstable::load() { // @clustering_key: it's expected that clustering key is already in its composite form. // NOTE: empty clustering key means that there is no clustering key. -void sstable::write_column_name(file_writer& out, const composite& clustering_key, const std::vector& column_names, composite_marker m) { +void sstable::write_column_name(file_writer& out, const composite& clustering_key, const std::vector& column_names, composite::eoc marker) { // FIXME: min_components and max_components also keep track of clustering // prefix, so we must merge clustering_key and column_names somehow and // pass the result to the functions below. column_name_helper::min_max_components(_c_stats.min_column_names, _c_stats.max_column_names, column_names); // was defined in the schema, for example. - auto c= composite::from_exploded(column_names, m); + auto c = composite::from_exploded(column_names, marker); auto ck_bview = bytes_view(clustering_key); // The marker is not a component, so if the last component is empty (IOW, @@ -1197,14 +1197,14 @@ void sstable::write_range_tombstone(file_writer& out, } auto start_marker = start_kind == bound_kind::excl_start - ? composite_marker::end_range - : composite_marker::start_range; + ? composite::eoc::end + : composite::eoc::start; write_column_name(out, start, suffix, start_marker); column_mask mask = column_mask::range_tombstone; write(out, mask); auto end_marker = end_kind == bound_kind::excl_end - ? composite_marker::start_range - : composite_marker::end_range; + ? composite::eoc::start + : composite::eoc::end; write_column_name(out, end, suffix, end_marker); uint64_t timestamp = t.timestamp; uint32_t deletion_time = t.deletion_time.time_since_epoch().count(); diff --git a/sstables/sstables.hh b/sstables/sstables.hh index d92aeac248..2740f832b2 100644 --- a/sstables/sstables.hh +++ b/sstables/sstables.hh @@ -47,6 +47,7 @@ #include "mutation_reader.hh" #include "query-request.hh" #include "key_reader.hh" +#include "compound_compat.hh" namespace sstables { @@ -481,7 +482,7 @@ private: void write_clustered_row(file_writer& out, const schema& schema, const clustering_row& clustered_row); void write_static_row(file_writer& out, const schema& schema, const row& static_row); void write_cell(file_writer& out, atomic_cell_view cell); - void write_column_name(file_writer& out, const composite& clustering_key, const std::vector& column_names, composite_marker m = composite_marker::none); + void write_column_name(file_writer& out, const composite& clustering_key, const std::vector& column_names, composite::eoc marker = composite::eoc::none); void write_column_name(file_writer& out, bytes_view column_names); void write_range_tombstone(file_writer& out, const composite& start, bound_kind start_kind, const composite& end, bound_kind stop_kind, std::vector suffix, const tombstone t); void write_range_tombstone(file_writer& out, const composite& start, const composite& end, std::vector suffix, const tombstone t) {