wallet: bdb: move BerkeleyDatabase constructor to cpp file

Else some compilers/stdlibs may not be able to construct
std::unique_ptr<Db> without Db defined.
This commit is contained in:
Cory Fields 2023-07-06 19:29:27 +00:00
parent b3582baa3a
commit 004b184b02
2 changed files with 8 additions and 6 deletions

View File

@ -296,6 +296,13 @@ static Span<const std::byte> SpanFromDbt(const SafeDbt& dbt)
return {reinterpret_cast<const std::byte*>(dbt.get_data()), dbt.get_size()};
}
BerkeleyDatabase::BerkeleyDatabase(std::shared_ptr<BerkeleyEnvironment> env, fs::path filename, const DatabaseOptions& options) :
WalletDatabase(), env(std::move(env)), m_filename(std::move(filename)), m_max_log_mb(options.max_log_mb)
{
auto inserted = this->env->m_databases.emplace(m_filename, std::ref(*this));
assert(inserted.second);
}
bool BerkeleyDatabase::Verify(bilingual_str& errorStr)
{
fs::path walletDir = env->Directory();

View File

@ -84,12 +84,7 @@ public:
BerkeleyDatabase() = delete;
/** Create DB handle to real database */
BerkeleyDatabase(std::shared_ptr<BerkeleyEnvironment> env, fs::path filename, const DatabaseOptions& options) :
WalletDatabase(), env(std::move(env)), m_filename(std::move(filename)), m_max_log_mb(options.max_log_mb)
{
auto inserted = this->env->m_databases.emplace(m_filename, std::ref(*this));
assert(inserted.second);
}
BerkeleyDatabase(std::shared_ptr<BerkeleyEnvironment> env, fs::path filename, const DatabaseOptions& options);
~BerkeleyDatabase() override;