From b64187d05f327992c304836fe1fc1d276ec80c36 Mon Sep 17 00:00:00 2001 From: Brandon Dahler Date: Tue, 5 Nov 2013 19:58:43 -0600 Subject: [PATCH] Rename leveldb.{h,cpp} to leveldbwrapper.{h,cpp}. --- src/Makefile.am | 4 ++-- src/{leveldb.cpp => leveldbwrapper.cpp} | 10 +++++----- src/{leveldb.h => leveldbwrapper.h} | 19 ++++++++++--------- src/txdb.cpp | 2 +- src/txdb.h | 6 +++--- 5 files changed, 21 insertions(+), 20 deletions(-) rename src/{leveldb.cpp => leveldbwrapper.cpp} (87%) rename src/{leveldb.h => leveldbwrapper.h} (91%) diff --git a/src/Makefile.am b/src/Makefile.am index 508063d5e..b09c65659 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 similarity index 87% rename from src/leveldb.cpp rename to src/leveldbwrapper.cpp index fb202367c..399208e66 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 @@ -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 similarity index 91% rename from src/leveldb.h rename to src/leveldbwrapper.h index 7daddeb49..b4cc53b50 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 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 27d6caf4d..f459f0c71 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -66,7 +66,7 @@ bool CCoinsViewDB::BatchWrite(const std::map &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 b555be3de..4bc2902a0 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);