diff --git a/db/extensions.cc b/db/extensions.cc index 173e9cc90e..1a6890d758 100644 --- a/db/extensions.cc +++ b/db/extensions.cc @@ -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 ext) { const_cast(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; +} diff --git a/db/extensions.hh b/db/extensions.hh index eb0d0d5d52..49fa6fdc08 100644 --- a/db/extensions.hh +++ b/db/extensions.hh @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -97,9 +98,27 @@ public: * config apply. */ void add_extension_to_schema(schema_ptr, const sstring&, shared_ptr); + + /** + * 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 _schema_extensions; std::map _sstable_file_io_extensions; std::map _commitlog_file_extensions; + std::unordered_set _extension_internal_keyspaces; }; }