aboutsummaryrefslogtreecommitdiff
path: root/src/leveldbwrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/leveldbwrapper.cpp')
-rw-r--r--src/leveldbwrapper.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp
index 641d25152d..6ecf7c7f0e 100644
--- a/src/leveldbwrapper.cpp
+++ b/src/leveldbwrapper.cpp
@@ -15,18 +15,18 @@
#include <memenv.h>
#include <stdint.h>
-void HandleError(const leveldb::Status& status) throw(leveldb_error)
+void HandleError(const leveldb::Status& status) throw(dbwrapper_error)
{
if (status.ok())
return;
LogPrintf("%s\n", status.ToString());
if (status.IsCorruption())
- throw leveldb_error("Database corrupted");
+ throw dbwrapper_error("Database corrupted");
if (status.IsIOError())
- throw leveldb_error("Database I/O error");
+ throw dbwrapper_error("Database I/O error");
if (status.IsNotFound())
- throw leveldb_error("Database entry missing");
- throw leveldb_error("Unknown database error");
+ throw dbwrapper_error("Database entry missing");
+ throw dbwrapper_error("Unknown database error");
}
static leveldb::Options GetOptions(size_t nCacheSize)
@@ -45,7 +45,7 @@ static leveldb::Options GetOptions(size_t nCacheSize)
return options;
}
-CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
+CDBWrapper::CDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate)
{
penv = NULL;
readoptions.verify_checksums = true;
@@ -90,7 +90,7 @@ CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCa
LogPrintf("Using obfuscation key for %s: %s\n", path.string(), GetObfuscateKeyHex());
}
-CLevelDBWrapper::~CLevelDBWrapper()
+CDBWrapper::~CDBWrapper()
{
delete pdb;
pdb = NULL;
@@ -102,7 +102,7 @@ CLevelDBWrapper::~CLevelDBWrapper()
options.env = NULL;
}
-bool CLevelDBWrapper::WriteBatch(CLevelDBBatch& batch, bool fSync) throw(leveldb_error)
+bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync) throw(dbwrapper_error)
{
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
HandleError(status);
@@ -113,15 +113,15 @@ bool CLevelDBWrapper::WriteBatch(CLevelDBBatch& batch, bool fSync) throw(leveldb
//
// We must use a string constructor which specifies length so that we copy
// past the null-terminator.
-const std::string CLevelDBWrapper::OBFUSCATE_KEY_KEY("\000obfuscate_key", 14);
+const std::string CDBWrapper::OBFUSCATE_KEY_KEY("\000obfuscate_key", 14);
-const unsigned int CLevelDBWrapper::OBFUSCATE_KEY_NUM_BYTES = 8;
+const unsigned int CDBWrapper::OBFUSCATE_KEY_NUM_BYTES = 8;
/**
* Returns a string (consisting of 8 random bytes) suitable for use as an
* obfuscating XOR key.
*/
-std::vector<unsigned char> CLevelDBWrapper::CreateObfuscateKey() const
+std::vector<unsigned char> CDBWrapper::CreateObfuscateKey() const
{
unsigned char buff[OBFUSCATE_KEY_NUM_BYTES];
GetRandBytes(buff, OBFUSCATE_KEY_NUM_BYTES);
@@ -129,24 +129,24 @@ std::vector<unsigned char> CLevelDBWrapper::CreateObfuscateKey() const
}
-bool CLevelDBWrapper::IsEmpty()
+bool CDBWrapper::IsEmpty()
{
- boost::scoped_ptr<CLevelDBIterator> it(NewIterator());
+ boost::scoped_ptr<CDBIterator> it(NewIterator());
it->SeekToFirst();
return !(it->Valid());
}
-const std::vector<unsigned char>& CLevelDBWrapper::GetObfuscateKey() const
+const std::vector<unsigned char>& CDBWrapper::GetObfuscateKey() const
{
return obfuscate_key;
}
-std::string CLevelDBWrapper::GetObfuscateKeyHex() const
+std::string CDBWrapper::GetObfuscateKeyHex() const
{
return HexStr(obfuscate_key);
}
-CLevelDBIterator::~CLevelDBIterator() { delete piter; }
-bool CLevelDBIterator::Valid() { return piter->Valid(); }
-void CLevelDBIterator::SeekToFirst() { piter->SeekToFirst(); }
-void CLevelDBIterator::Next() { piter->Next(); }
+CDBIterator::~CDBIterator() { delete piter; }
+bool CDBIterator::Valid() { return piter->Valid(); }
+void CDBIterator::SeekToFirst() { piter->SeekToFirst(); }
+void CDBIterator::Next() { piter->Next(); }