Bitcoin
Namespaces | Functions | Variables
db.cpp File Reference
#include <wallet/db.h>
#include <util/strencodings.h>
#include <stdint.h>
#include <sys/stat.h>
#include <boost/thread.hpp>

Namespaces

 anonymous_namespace{db.cpp}
 

Functions

void anonymous_namespace{db.cpp}::CheckUniqueFileid (const BerkeleyEnvironment &env, const std::string &filename, Db &db, WalletDatabaseFileId &fileid)
 
std::map< std::string, std::weak_ptr< BerkeleyEnvironment > > g_dbenvs anonymous_namespace{db.cpp}::GUARDED_BY (cs_db)
 Map from directory name to db environment. More...
 
static void SplitWalletPath (const fs::path &wallet_path, fs::path &env_directory, std::string &database_filename)
 
bool IsWalletLoaded (const fs::path &wallet_path)
 
fs::path WalletDataFilePath (const fs::path &wallet_path)
 
std::shared_ptr< BerkeleyEnvironmentGetWalletEnv (const fs::path &wallet_path, std::string &database_filename)
 

Variables

CCriticalSection anonymous_namespace{db.cpp}::cs_db
 
static const char * HEADER_END = "HEADER=END"
 
static const char * DATA_END = "DATA=END"
 

Function Documentation

◆ GetWalletEnv()

std::shared_ptr<BerkeleyEnvironment> GetWalletEnv ( const fs::path &  wallet_path,
std::string &  database_filename 
)
Parameters
[in]wallet_pathPath to wallet directory. Or (for backwards compatibility only) a path to a berkeley btree data file inside a wallet directory.
[out]database_filenameFilename of berkeley btree data file inside the wallet directory.
Returns
A shared pointer to the BerkeleyEnvironment object for the wallet directory, never empty because ~BerkeleyEnvironment erases the weak pointer from the g_dbenvs map.
Postcondition
A new BerkeleyEnvironment weak pointer is inserted into g_dbenvs if the directory path key was not already in the map.

◆ IsWalletLoaded()

bool IsWalletLoaded ( const fs::path &  wallet_path)

Return whether a wallet database is currently loaded.

◆ SplitWalletPath()

static void SplitWalletPath ( const fs::path &  wallet_path,
fs::path &  env_directory,
std::string &  database_filename 
)
static

◆ WalletDataFilePath()

fs::path WalletDataFilePath ( const fs::path &  wallet_path)

Given a wallet directory path or legacy file path, return path to main data file in the wallet database.

Variable Documentation

◆ DATA_END

const char* DATA_END = "DATA=END"
static

◆ HEADER_END

const char* HEADER_END = "HEADER=END"
static