schema_tables: Add opaque context object

To allow carrying extensions and potentially more
This commit is contained in:
Calle Wilund
2018-01-30 15:39:18 +00:00
parent 2ee68ce0d4
commit c2b49ec2e2
2 changed files with 35 additions and 0 deletions

View File

@@ -83,6 +83,23 @@ using namespace std::chrono_literals;
/** system.schema_* tables used to store keyspace/table/type attributes prior to C* 3.0 */
namespace db {
schema_ctxt::schema_ctxt(const db::config& cfg)
: _extensions(cfg.extensions())
{}
schema_ctxt::schema_ctxt(const database& db)
: schema_ctxt(db.get_config())
{}
schema_ctxt::schema_ctxt(distributed<database>& db)
: schema_ctxt(db.local())
{}
schema_ctxt::schema_ctxt(distributed<service::storage_proxy>& proxy)
: schema_ctxt(proxy.local().get_db())
{}
namespace schema_tables {
logging::logger slogger("schema_tables");

View File

@@ -54,6 +54,24 @@ class result_set;
}
namespace db {
class extensions;
class config;
class schema_ctxt {
public:
schema_ctxt(const config&);
schema_ctxt(const database&);
schema_ctxt(distributed<database>&);
schema_ctxt(distributed<service::storage_proxy>&);
const db::extensions& extensions() const {
return _extensions;
}
private:
const db::extensions& _extensions;
};
namespace schema_tables {
using schema_result = std::map<sstring, lw_shared_ptr<query::result_set>>;