From f2ecf617bab221cf6baa05161fb6438d23722e56 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 3 Dec 2018 12:30:59 -0800 Subject: [PATCH] ircd::db: Stub a place to put the runtime loaded library version information. --- include/ircd/db/db.h | 8 ++++++++ ircd/db.cc | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/ircd/db/db.h b/include/ircd/db/db.h index 3f8b9673e..3eef3b125 100644 --- a/include/ircd/db/db.h +++ b/include/ircd/db/db.h @@ -74,8 +74,15 @@ namespace ircd::db // namespace ircd::db { + // Version information from rocksdb headers (when building ircd). extern const uint version[3]; extern const string_view version_str; + + // Version of the RocksDB shared library (when running ircd). + extern const uint abi_version[3]; + extern const string_view abi_version_str; + + // Supported compressions (detected when running ircd) extern std::array compressions; // Utils for "name:checkpoint" string amalgam @@ -86,6 +93,7 @@ namespace ircd::db std::string path(const string_view &name, const uint64_t &checkpoint); std::string path(const string_view &name); + // Paths of available databases. std::vector available(); } diff --git a/ircd/db.cc b/ircd/db.cc index 60ef09e6d..98b69f725 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -152,6 +152,27 @@ ircd::db::version_str version[2]) ); +decltype(ircd::db::abi_version) +ircd::db::abi_version +{ + //TODO: Get lib version. + 0, + 0, + 0, +}; + +char ircd_db_abi_version_str_buf[64]; +decltype(ircd::db::abi_version_str) +ircd::db::abi_version_str +( + ircd_db_abi_version_str_buf, + ::snprintf(ircd_db_abi_version_str_buf, sizeof(ircd_db_abi_version_str_buf), + "%u.%u.%u", + abi_version[0], + abi_version[1], + abi_version[2]) +); + // // init::init //