mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-16 21:20:43 +02:00
walletdb: Move Rewrite into BerkeleyDatabase
Make Rewrite actually a member of BerkeleyDatabase instead of a static function in BerkeleyBatch
This commit is contained in:
parent
91d109156d
commit
d8e9ca66d1
@ -484,13 +484,11 @@ void BerkeleyEnvironment::ReloadDbEnv()
|
|||||||
Open(true);
|
Open(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BerkeleyBatch::Rewrite(BerkeleyDatabase& database, const char* pszSkip)
|
bool BerkeleyDatabase::Rewrite(const char* pszSkip)
|
||||||
{
|
{
|
||||||
if (database.IsDummy()) {
|
if (IsDummy()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BerkeleyEnvironment *env = database.env.get();
|
|
||||||
const std::string& strFile = database.strFile;
|
|
||||||
while (true) {
|
while (true) {
|
||||||
{
|
{
|
||||||
LOCK(cs_db);
|
LOCK(cs_db);
|
||||||
@ -504,7 +502,7 @@ bool BerkeleyBatch::Rewrite(BerkeleyDatabase& database, const char* pszSkip)
|
|||||||
LogPrintf("BerkeleyBatch::Rewrite: Rewriting %s...\n", strFile);
|
LogPrintf("BerkeleyBatch::Rewrite: Rewriting %s...\n", strFile);
|
||||||
std::string strFileRes = strFile + ".rewrite";
|
std::string strFileRes = strFile + ".rewrite";
|
||||||
{ // surround usage of db with extra {}
|
{ // surround usage of db with extra {}
|
||||||
BerkeleyBatch db(database, "r");
|
BerkeleyBatch db(*this, "r");
|
||||||
std::unique_ptr<Db> pdbCopy = MakeUnique<Db>(env->dbenv.get(), 0);
|
std::unique_ptr<Db> pdbCopy = MakeUnique<Db>(env->dbenv.get(), 0);
|
||||||
|
|
||||||
int ret = pdbCopy->open(nullptr, // Txn pointer
|
int ret = pdbCopy->open(nullptr, // Txn pointer
|
||||||
@ -654,11 +652,6 @@ bool BerkeleyDatabase::PeriodicFlush()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BerkeleyDatabase::Rewrite(const char* pszSkip)
|
|
||||||
{
|
|
||||||
return BerkeleyBatch::Rewrite(*this, pszSkip);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BerkeleyDatabase::Backup(const std::string& strDest) const
|
bool BerkeleyDatabase::Backup(const std::string& strDest) const
|
||||||
{
|
{
|
||||||
if (IsDummy()) {
|
if (IsDummy()) {
|
||||||
|
@ -287,8 +287,6 @@ public:
|
|||||||
bool TxnBegin();
|
bool TxnBegin();
|
||||||
bool TxnCommit();
|
bool TxnCommit();
|
||||||
bool TxnAbort();
|
bool TxnAbort();
|
||||||
|
|
||||||
bool static Rewrite(BerkeleyDatabase& database, const char* pszSkip = nullptr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string BerkeleyDatabaseVersion();
|
std::string BerkeleyDatabaseVersion();
|
||||||
|
Loading…
Reference in New Issue
Block a user