db::extentions: Add "extensions internal" keyspace set
Refs #13334 To be populated early by extensions. Such a keyspace should be 1.) Started before user keyspaces 2.) Flushed/closed after user keyspaces 3.) For all other regards be considered "user".
This commit is contained in:
@@ -54,3 +54,20 @@ void db::extensions::add_commitlog_file_extension(sstring n, commitlog_file_exte
|
||||
void db::extensions::add_extension_to_schema(schema_ptr s, const sstring& name, shared_ptr<schema_extension> ext) {
|
||||
const_cast<schema *>(s.get())->extensions()[name] = std::move(ext);
|
||||
}
|
||||
|
||||
void db::extensions::add_extension_internal_keyspace(std::string ks) {
|
||||
_extension_internal_keyspaces.emplace(std::move(ks));
|
||||
}
|
||||
|
||||
// TODO: remove once this is backmerged to ent once, and relevant code is updated.
|
||||
extern bool is_load_prio_keyspace(std::string_view name);
|
||||
|
||||
bool db::extensions::is_extension_internal_keyspace(const std::string& ks) const {
|
||||
if (_extension_internal_keyspaces.count(ks)) {
|
||||
return true;
|
||||
}
|
||||
if (::is_load_prio_keyspace(ks)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <seastar/core/sstring.hh>
|
||||
|
||||
@@ -97,9 +98,27 @@ public:
|
||||
* config apply.
|
||||
*/
|
||||
void add_extension_to_schema(schema_ptr, const sstring&, shared_ptr<schema_extension>);
|
||||
|
||||
/**
|
||||
* Adds a keyspace to "extension internal" set.
|
||||
*
|
||||
* Such a keyspace must be loaded before/destroyed after any "normal" user keyspace.
|
||||
* Thus a psuedo-system/internal keyspce.
|
||||
* This has little to no use in open source version, and is temporarily bridged with
|
||||
* the static version of same functionality in distributed loader. It is however (or will
|
||||
* be), essential to enterprise code. Do not remove.
|
||||
*/
|
||||
void add_extension_internal_keyspace(std::string);
|
||||
|
||||
/**
|
||||
* Checks if a keyspace is a registered load priority one.
|
||||
*/
|
||||
bool is_extension_internal_keyspace(const std::string&) const;
|
||||
|
||||
private:
|
||||
std::map<sstring, schema_ext_create_func> _schema_extensions;
|
||||
std::map<sstring, sstable_file_io_extension> _sstable_file_io_extensions;
|
||||
std::map<sstring, commitlog_file_extension_ptr> _commitlog_file_extensions;
|
||||
std::unordered_set<std::string> _extension_internal_keyspaces;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user