schema: Provide all-selecting partition slice

This patch introduces schema::full_slice(), which returns a
partition_slice selecting the full clustering range, as well as all
static and regular columns. No options aside from the default are
set in that partition_slice.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <1507732800-9448-1-git-send-email-duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2017-10-11 14:39:59 +00:00
committed by Tomasz Grabiec
parent 6d5a0f8a98
commit fbb4c9edda
2 changed files with 11 additions and 0 deletions

View File

@@ -34,6 +34,7 @@
#include <boost/range/algorithm.hpp>
#include <boost/algorithm/cxx11/any_of.hpp>
#include "view_info.hh"
#include "partition_slice_builder.hh"
constexpr int32_t schema::NAME_LENGTH;
@@ -240,6 +241,7 @@ void schema::rebuild() {
}
_v3_columns = v3_columns::from_v2_schema(*this);
_full_slice = make_shared(partition_slice_builder(*this).build());
}
const column_mapping& schema::get_column_mapping() const {

View File

@@ -408,6 +408,10 @@ public:
void apply_to(schema_builder&) const;
};
namespace query {
class partition_slice;
}
/*
* Effectively immutable.
* Not safe to access across cores because of shared_ptr's.
@@ -481,6 +485,8 @@ private:
lw_shared_ptr<compound_type<allow_prefixes::no>> _partition_key_type;
lw_shared_ptr<compound_type<allow_prefixes::yes>> _clustering_key_type;
column_mapping _column_mapping;
shared_ptr<query::partition_slice> _full_slice;
friend class schema_builder;
public:
using row_column_ids_are_ordered_by_name = std::true_type;
@@ -713,6 +719,9 @@ public:
bool is_view() const {
return bool(_view_info);
}
const query::partition_slice& full_slice() const {
return *_full_slice;
}
// Returns all index names of this schema.
std::vector<sstring> index_names() const;
// Returns all indices of this schema.