From c2b49ec2e27f8eecd45c6896a184f9b2bd5046ab Mon Sep 17 00:00:00 2001 From: Calle Wilund Date: Tue, 30 Jan 2018 15:39:18 +0000 Subject: [PATCH] schema_tables: Add opaque context object To allow carrying extensions and potentially more --- db/schema_tables.cc | 17 +++++++++++++++++ db/schema_tables.hh | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/db/schema_tables.cc b/db/schema_tables.cc index 669fe6d686..fe7f73b4cc 100644 --- a/db/schema_tables.cc +++ b/db/schema_tables.cc @@ -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& db) + : schema_ctxt(db.local()) +{} + +schema_ctxt::schema_ctxt(distributed& proxy) + : schema_ctxt(proxy.local().get_db()) +{} + namespace schema_tables { logging::logger slogger("schema_tables"); diff --git a/db/schema_tables.hh b/db/schema_tables.hh index 08146ec799..6c10101975 100644 --- a/db/schema_tables.hh +++ b/db/schema_tables.hh @@ -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&); + schema_ctxt(distributed&); + + const db::extensions& extensions() const { + return _extensions; + } +private: + const db::extensions& _extensions; +}; + namespace schema_tables { using schema_result = std::map>;