Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/db.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | bool CDBEnv::Open(const fs::path &pathIn) { | ||||
strPath = pathIn.string(); | strPath = pathIn.string(); | ||||
fs::path pathLogDir = pathIn / "database"; | fs::path pathLogDir = pathIn / "database"; | ||||
TryCreateDirectories(pathLogDir); | TryCreateDirectories(pathLogDir); | ||||
fs::path pathErrorFile = pathIn / "db.log"; | fs::path pathErrorFile = pathIn / "db.log"; | ||||
LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), | LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), | ||||
pathErrorFile.string()); | pathErrorFile.string()); | ||||
unsigned int nEnvFlags = 0; | unsigned int nEnvFlags = 0; | ||||
if (GetBoolArg("-privdb", DEFAULT_WALLET_PRIVDB)) { | if (gArgs.GetBoolArg("-privdb", DEFAULT_WALLET_PRIVDB)) { | ||||
nEnvFlags |= DB_PRIVATE; | nEnvFlags |= DB_PRIVATE; | ||||
} | } | ||||
dbenv->set_lg_dir(pathLogDir.string().c_str()); | dbenv->set_lg_dir(pathLogDir.string().c_str()); | ||||
// 1 MiB should be enough for just the wallet | // 1 MiB should be enough for just the wallet | ||||
dbenv->set_cachesize(0, 0x100000, 1); | dbenv->set_cachesize(0, 0x100000, 1); | ||||
dbenv->set_lg_bsize(0x10000); | dbenv->set_lg_bsize(0x10000); | ||||
dbenv->set_lg_max(1048576); | dbenv->set_lg_max(1048576); | ||||
▲ Show 20 Lines • Show All 359 Lines • ▼ Show 20 Lines | void CDB::Flush() { | ||||
// Flush database activity from memory pool to disk log | // Flush database activity from memory pool to disk log | ||||
unsigned int nMinutes = 0; | unsigned int nMinutes = 0; | ||||
if (fReadOnly) { | if (fReadOnly) { | ||||
nMinutes = 1; | nMinutes = 1; | ||||
} | } | ||||
env->dbenv->txn_checkpoint( | env->dbenv->txn_checkpoint( | ||||
nMinutes ? GetArg("-dblogsize", DEFAULT_WALLET_DBLOGSIZE) * 1024 : 0, | nMinutes ? gArgs.GetArg("-dblogsize", DEFAULT_WALLET_DBLOGSIZE) * 1024 | ||||
: 0, | |||||
nMinutes, 0); | nMinutes, 0); | ||||
} | } | ||||
void CWalletDBWrapper::IncrementUpdateCounter() { | void CWalletDBWrapper::IncrementUpdateCounter() { | ||||
++nUpdateCounter; | ++nUpdateCounter; | ||||
} | } | ||||
void CDB::Close() { | void CDB::Close() { | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |