0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 16:33:53 +01:00

ircd::db: Add init warning for no compression; minor reorg inits.

This commit is contained in:
Jason Volk 2018-06-12 00:24:59 -07:00
parent 5d79f0e83b
commit 5ab8b9bdae

View file

@ -80,6 +80,7 @@ ircd::db::rog
namespace ircd::db
{
static void init_compressions();
static void init_directory();
static void init_version();
}
@ -87,18 +88,18 @@ namespace ircd::db
static char ircd_db_version[64];
const char *const ircd::db::version(ircd_db_version);
// Renders a version string from the defines included here.
__attribute__((constructor))
static void
ircd::db::init_version()
ircd::db::init::init()
{
snprintf(ircd_db_version, sizeof(ircd_db_version), "%d.%d.%d",
ROCKSDB_MAJOR,
ROCKSDB_MINOR,
ROCKSDB_PATCH);
init_compressions();
init_directory();
}
static void
ircd::db::init::~init()
noexcept
{
}
void
ircd::db::init_directory()
try
{
@ -119,14 +120,31 @@ catch(const fs::error &e)
throw;
}
ircd::db::init::init()
void
ircd::db::init_compressions()
{
init_directory();
const auto compressions
{
rocksdb::GetSupportedCompressions()
};
if(compressions.empty())
log::warning
{
"No compression libraries have been linked with the DB."
" This is probably not what you want."
};
}
ircd::db::init::~init()
noexcept
// Renders a version string from the defines included here.
__attribute__((constructor))
void
ircd::db::init_version()
{
snprintf(ircd_db_version, sizeof(ircd_db_version), "%d.%d.%d",
ROCKSDB_MAJOR,
ROCKSDB_MINOR,
ROCKSDB_PATCH);
}
///////////////////////////////////////////////////////////////////////////////