MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / CLevelDBWrapper

Method CLevelDBWrapper

src/leveldbwrapper.cpp:46–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool &isObfuscated, bool fMemory, bool fWipe)
47{
48 penv = NULL;
49 readoptions.verify_checksums = true;
50 iteroptions.verify_checksums = true;
51 iteroptions.fill_cache = false;
52 syncoptions.sync = true;
53 options = GetOptions(nCacheSize);
54 options.create_if_missing = true;
55 if (fMemory) {
56 penv = leveldb::NewMemEnv(leveldb::Env::Default());
57 options.env = penv;
58 } else {
59 if (fWipe) {
60 LogPrintf("Wiping LevelDB in %s\n", path.string());
61 leveldb::DestroyDB(path.string(), options);
62 }
63 TryCreateDirectory(path);
64 LogPrintf("Opening LevelDB in %s\n", path.string());
65 }
66 leveldb::Status status = leveldb::DB::Open(options, path.string(), &pdb);
67 HandleError(status);
68 LogPrintf("Opened LevelDB successfully\n");
69
70 std::vector<unsigned char> obfuscate_key;
71 isObfuscated = Read(OBFUSCATE_KEY_KEY, obfuscate_key);
72}
73
74CLevelDBWrapper::~CLevelDBWrapper()
75{

Callers

nothing calls this directly

Calls 5

GetOptionsFunction · 0.85
NewMemEnvFunction · 0.85
DestroyDBFunction · 0.85
TryCreateDirectoryFunction · 0.85
HandleErrorFunction · 0.85

Tested by

no test coverage detected