From 41fd658b247d9b1b96fc29eff4698ce93bada4f0 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 12 Dec 2018 09:57:46 -0800 Subject: [PATCH] ircd::db: Add interface to get column and database options. --- include/ircd/db/column.h | 1 + include/ircd/db/database/database.h | 1 + include/ircd/db/db.h | 1 + ircd/db.cc | 20 ++++++++++++++++++++ 4 files changed, 23 insertions(+) diff --git a/include/ircd/db/column.h b/include/ircd/db/column.h index a8ebd7356..69a11495a 100644 --- a/include/ircd/db/column.h +++ b/include/ircd/db/column.h @@ -22,6 +22,7 @@ namespace ircd::db std::vector files(const column &); size_t file_count(const column &); size_t bytes(const column &); + options getopt(const column &); // Get property data of a db column. R can optionally be uint64_t for some // values; we typedef that as prop_int for templating purposes. R can also diff --git a/include/ircd/db/database/database.h b/include/ircd/db/database/database.h index c6eff0940..691f3d58b 100644 --- a/include/ircd/db/database/database.h +++ b/include/ircd/db/database/database.h @@ -29,6 +29,7 @@ namespace ircd::db std::vector wals(const database &); size_t file_count(const database &); size_t bytes(const database &); + options getopt(const database &); log::facility loglevel(const database &); // Property information interface diff --git a/include/ircd/db/db.h b/include/ircd/db/db.h index 912a7ef8b..f142734d6 100644 --- a/include/ircd/db/db.h +++ b/include/ircd/db/db.h @@ -22,6 +22,7 @@ namespace ircd::db struct column; struct index; struct database; + struct options; // Errors for the database subsystem. The exceptions that use _HIDENAME // are built from RocksDB errors which already have an info string with diff --git a/ircd/db.cc b/ircd/db.cc index 5701bda83..5b76eacb6 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -639,6 +639,15 @@ ircd::db::loglevel(const database &d) } } +ircd::db::options +ircd::db::getopt(const database &d) +{ + return options + { + d.d->GetDBOptions() + }; +} + size_t ircd::db::bytes(const database &d) { @@ -9018,6 +9027,17 @@ ircd::db::property(const column &column, return ret; } +ircd::db::options +ircd::db::getopt(const column &column) +{ + database &d(const_cast(column)); + database::column &c(const_cast(column)); + return options + { + static_cast(d.d->GetOptions(c)) + }; +} + size_t ircd::db::bytes(const column &column) {