13 #include <boost/filesystem.hpp>
18 if (status.IsCorruption())
20 if (status.IsIOError())
22 if (status.IsNotFound())
37 CLevelDB::CLevelDB(
const boost::filesystem::path &path,
size_t nCacheSize,
bool fMemory,
bool fWipe) {
43 options = GetOptions(nCacheSize);
50 printf(
"Wiping LevelDB in %s\n", path.string().c_str());
53 boost::filesystem::create_directory(path);
54 printf(
"Opening LevelDB in %s\n", path.string().c_str());
58 throw std::runtime_error(
strprintf(
"CLevelDB(): error opening database environment %s", status.
ToString().c_str()));
59 printf(
"Opened LevelDB successfully\n");
74 leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory=false, bool fWipe=false)
#define strprintf(format,...)
bool WriteBatch(CLevelDBBatch &batch, bool fSync=false)
Status DestroyDB(const std::string &dbname, const Options &options)
static Status Open(const Options &options, const std::string &name, DB **dbptr)
const FilterPolicy * NewBloomFilterPolicy(int bits_per_key)
leveldb::ReadOptions iteroptions
const FilterPolicy * filter_policy
Cache * NewLRUCache(size_t capacity)
CompressionType compression
leveldb::ReadOptions readoptions
void HandleError(const leveldb::Status &status)
leveldb::WriteOptions syncoptions
Env * NewMemEnv(Env *base_env)
std::string ToString() const