MCPcopy Create free account
hub / github.com/LUX-Core/lux / CLevelDBWrapper

Method CLevelDBWrapper

src/leveldbwrapper.cpp:73–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool fMemory, bool fWipe)
74{
75 penv = NULL;
76 readoptions.verify_checksums = true;
77 iteroptions.verify_checksums = true;
78 iteroptions.fill_cache = false;
79 syncoptions.sync = true;
80 options = GetOptions(nCacheSize);
81 options.create_if_missing = true;
82 if (fMemory) {
83 penv = leveldb::NewMemEnv(leveldb::Env::Default());
84 options.env = penv;
85 } else {
86 if (fWipe) {
87 LogPrintf("Wiping LevelDB in %s\n", path.string());
88 leveldb::DestroyDB(path.string(), options);
89 }
90 TryCreateDirectory(path);
91 LogPrintf("Opening LevelDB in %s\n", path.string());
92 }
93 leveldb::Status status = leveldb::DB::Open(options, path.string(), &pdb);
94 HandleError(status);
95 LogPrintf("Opened LevelDB successfully\n");
96}
97
98CLevelDBWrapper::~CLevelDBWrapper()
99{

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