| 71 | } |
| 72 | |
| 73 | CLevelDBWrapper::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 | |
| 98 | CLevelDBWrapper::~CLevelDBWrapper() |
| 99 | { |
nothing calls this directly
no test coverage detected