index: make non-pointer overload of is_index function

Previous interface enforced passing a shared pointer, which
might result in calling unneeded shared_from_this().
This commit is contained in:
Piotr Sarna
2019-02-14 16:23:05 +01:00
parent 94db098d39
commit cb20fc2e4f
2 changed files with 7 additions and 2 deletions

View File

@@ -157,8 +157,12 @@ std::vector<index> secondary_index_manager::list_indexes() const {
}
bool secondary_index_manager::is_index(view_ptr view) const {
return boost::algorithm::any_of(_indices | boost::adaptors::map_values, [&view] (const index& i) {
return view->cf_name() == index_table_name(i.metadata().name());
return is_index(*view);
}
bool secondary_index_manager::is_index(const schema& s) const {
return boost::algorithm::any_of(_indices | boost::adaptors::map_values, [&s] (const index& i) {
return s.cf_name() == index_table_name(i.metadata().name());
});
}

View File

@@ -76,6 +76,7 @@ public:
std::vector<index_metadata> get_dependent_indices(const column_definition& cdef) const;
std::vector<index> list_indexes() const;
bool is_index(view_ptr) const;
bool is_index(const schema& s) const;
private:
void add_index(const index_metadata& im);
};