diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/leveldbwrapper.cpp (renamed from src/leveldb.cpp) | 10 | ||||
-rw-r--r-- | src/leveldbwrapper.h (renamed from src/leveldb.h) | 19 | ||||
-rw-r--r-- | src/txdb.cpp | 2 | ||||
-rw-r--r-- | src/txdb.h | 6 |
5 files changed, 21 insertions, 20 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 508063d5e2..b09c656597 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,7 @@ DIST_SUBDIRS = . qt test BITCOIN_CORE_H = addrman.h alert.h allocators.h base58.h bignum.h \ bitcoinrpc.h bloom.h chainparams.h checkpoints.h checkqueue.h \ clientversion.h compat.h core.h crypter.h db.h hash.h init.h \ - key.h keystore.h leveldb.h limitedmap.h main.h miner.h mruset.h \ + key.h keystore.h leveldbwrapper.h limitedmap.h main.h miner.h mruset.h \ netbase.h net.h protocol.h script.h serialize.h sync.h threadsafety.h \ txdb.h txmempool.h ui_interface.h uint256.h util.h version.h walletdb.h wallet.h @@ -33,7 +33,7 @@ version.o: obj/build.h libbitcoin_a_SOURCES = addrman.cpp alert.cpp allocators.cpp bitcoinrpc.cpp bloom.cpp \ chainparams.cpp checkpoints.cpp core.cpp crypter.cpp db.cpp hash.cpp \ - init.cpp key.cpp keystore.cpp leveldb.cpp main.cpp miner.cpp \ + init.cpp key.cpp keystore.cpp leveldbwrapper.cpp main.cpp miner.cpp \ netbase.cpp net.cpp noui.cpp protocol.cpp rpcblockchain.cpp rpcdump.cpp \ rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp script.cpp \ sync.cpp txdb.cpp txmempool.cpp util.cpp version.cpp wallet.cpp walletdb.cpp $(JSON_H) \ diff --git a/src/leveldb.cpp b/src/leveldbwrapper.cpp index fb202367c4..399208e66c 100644 --- a/src/leveldb.cpp +++ b/src/leveldbwrapper.cpp @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Bitcoin developers +// Copyright (c) 2012-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "leveldb.h" +#include "leveldbwrapper.h" #include "util.h" #include <leveldb/env.h> @@ -35,7 +35,7 @@ static leveldb::Options GetOptions(size_t nCacheSize) { return options; } -CLevelDB::CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory, bool fWipe) { +CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory, bool fWipe) { penv = NULL; readoptions.verify_checksums = true; iteroptions.verify_checksums = true; @@ -59,7 +59,7 @@ CLevelDB::CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool LogPrintf("Opened LevelDB successfully\n"); } -CLevelDB::~CLevelDB() { +CLevelDBWrapper::~CLevelDBWrapper() { delete pdb; pdb = NULL; delete options.filter_policy; @@ -70,7 +70,7 @@ CLevelDB::~CLevelDB() { options.env = NULL; } -bool CLevelDB::WriteBatch(CLevelDBBatch &batch, bool fSync) throw(leveldb_error) { +bool CLevelDBWrapper::WriteBatch(CLevelDBBatch &batch, bool fSync) throw(leveldb_error) { leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch); HandleError(status); return true; diff --git a/src/leveldb.h b/src/leveldbwrapper.h index 7daddeb493..b4cc53b50b 100644 --- a/src/leveldb.h +++ b/src/leveldbwrapper.h @@ -1,8 +1,9 @@ -// Copyright (c) 2012 The Bitcoin developers +// Copyright (c) 2012-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_LEVELDB_H -#define BITCOIN_LEVELDB_H + +#ifndef BITCOIN_LEVELDBWRAPPER_H +#define BITCOIN_LEVELDBWRAPPER_H #include "serialize.h" #include "util.h" @@ -20,10 +21,10 @@ public: void HandleError(const leveldb::Status &status) throw(leveldb_error); -// Batch of changes queued to be written to a CLevelDB +// Batch of changes queued to be written to a CLevelDBWrapper class CLevelDBBatch { - friend class CLevelDB; + friend class CLevelDBWrapper; private: leveldb::WriteBatch batch; @@ -53,7 +54,7 @@ public: } }; -class CLevelDB +class CLevelDBWrapper { private: // custom environment this database is using (may be NULL in case of default environment) @@ -78,8 +79,8 @@ private: leveldb::DB *pdb; public: - CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory = false, bool fWipe = false); - ~CLevelDB(); + CLevelDBWrapper(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory = false, bool fWipe = false); + ~CLevelDBWrapper(); template<typename K, typename V> bool Read(const K& key, V& value) throw(leveldb_error) { CDataStream ssKey(SER_DISK, CLIENT_VERSION); @@ -151,4 +152,4 @@ public: } }; -#endif // BITCOIN_LEVELDB_H +#endif // BITCOIN_LEVELDBWRAPPER_H diff --git a/src/txdb.cpp b/src/txdb.cpp index 27d6caf4d9..f459f0c71a 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -66,7 +66,7 @@ bool CCoinsViewDB::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockI return db.WriteBatch(batch); } -CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CLevelDB(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) { +CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CLevelDBWrapper(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) { } bool CBlockTreeDB::WriteBlockIndex(const CDiskBlockIndex& blockindex) diff --git a/src/txdb.h b/src/txdb.h index b555be3de7..4bc2902a0b 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -6,13 +6,13 @@ #define BITCOIN_TXDB_LEVELDB_H #include "main.h" -#include "leveldb.h" +#include "leveldbwrapper.h" /** CCoinsView backed by the LevelDB coin database (chainstate/) */ class CCoinsViewDB : public CCoinsView { protected: - CLevelDB db; + CLevelDBWrapper db; public: CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false); @@ -26,7 +26,7 @@ public: }; /** Access to the block database (blocks/index/) */ -class CBlockTreeDB : public CLevelDB +class CBlockTreeDB : public CLevelDBWrapper { public: CBlockTreeDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false); |