mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Rename leveldb.{h,cpp} to leveldbwrapper.{h,cpp}.
This commit is contained in:
parent
995cb284cf
commit
b64187d05f
@ -15,7 +15,7 @@ DIST_SUBDIRS = . qt test
|
|||||||
BITCOIN_CORE_H = addrman.h alert.h allocators.h base58.h bignum.h \
|
BITCOIN_CORE_H = addrman.h alert.h allocators.h base58.h bignum.h \
|
||||||
bitcoinrpc.h bloom.h chainparams.h checkpoints.h checkqueue.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 \
|
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 \
|
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
|
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 \
|
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 \
|
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 \
|
netbase.cpp net.cpp noui.cpp protocol.cpp rpcblockchain.cpp rpcdump.cpp \
|
||||||
rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp script.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) \
|
sync.cpp txdb.cpp txmempool.cpp util.cpp version.cpp wallet.cpp walletdb.cpp $(JSON_H) \
|
||||||
|
@ -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
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include "leveldb.h"
|
#include "leveldbwrapper.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <leveldb/env.h>
|
#include <leveldb/env.h>
|
||||||
@ -35,7 +35,7 @@ static leveldb::Options GetOptions(size_t nCacheSize) {
|
|||||||
return options;
|
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;
|
penv = NULL;
|
||||||
readoptions.verify_checksums = true;
|
readoptions.verify_checksums = true;
|
||||||
iteroptions.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");
|
LogPrintf("Opened LevelDB successfully\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CLevelDB::~CLevelDB() {
|
CLevelDBWrapper::~CLevelDBWrapper() {
|
||||||
delete pdb;
|
delete pdb;
|
||||||
pdb = NULL;
|
pdb = NULL;
|
||||||
delete options.filter_policy;
|
delete options.filter_policy;
|
||||||
@ -70,7 +70,7 @@ CLevelDB::~CLevelDB() {
|
|||||||
options.env = NULL;
|
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);
|
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
|
||||||
HandleError(status);
|
HandleError(status);
|
||||||
return true;
|
return true;
|
@ -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
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// 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 "serialize.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -20,10 +21,10 @@ public:
|
|||||||
|
|
||||||
void HandleError(const leveldb::Status &status) throw(leveldb_error);
|
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
|
class CLevelDBBatch
|
||||||
{
|
{
|
||||||
friend class CLevelDB;
|
friend class CLevelDBWrapper;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
leveldb::WriteBatch batch;
|
leveldb::WriteBatch batch;
|
||||||
@ -53,7 +54,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CLevelDB
|
class CLevelDBWrapper
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// custom environment this database is using (may be NULL in case of default environment)
|
// custom environment this database is using (may be NULL in case of default environment)
|
||||||
@ -78,8 +79,8 @@ private:
|
|||||||
leveldb::DB *pdb;
|
leveldb::DB *pdb;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
CLevelDBWrapper(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
||||||
~CLevelDB();
|
~CLevelDBWrapper();
|
||||||
|
|
||||||
template<typename K, typename V> bool Read(const K& key, V& value) throw(leveldb_error) {
|
template<typename K, typename V> bool Read(const K& key, V& value) throw(leveldb_error) {
|
||||||
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
||||||
@ -151,4 +152,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_LEVELDB_H
|
#endif // BITCOIN_LEVELDBWRAPPER_H
|
@ -66,7 +66,7 @@ bool CCoinsViewDB::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockI
|
|||||||
return db.WriteBatch(batch);
|
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)
|
bool CBlockTreeDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
#define BITCOIN_TXDB_LEVELDB_H
|
#define BITCOIN_TXDB_LEVELDB_H
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "leveldb.h"
|
#include "leveldbwrapper.h"
|
||||||
|
|
||||||
/** CCoinsView backed by the LevelDB coin database (chainstate/) */
|
/** CCoinsView backed by the LevelDB coin database (chainstate/) */
|
||||||
class CCoinsViewDB : public CCoinsView
|
class CCoinsViewDB : public CCoinsView
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CLevelDB db;
|
CLevelDBWrapper db;
|
||||||
public:
|
public:
|
||||||
CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Access to the block database (blocks/index/) */
|
/** Access to the block database (blocks/index/) */
|
||||||
class CBlockTreeDB : public CLevelDB
|
class CBlockTreeDB : public CLevelDBWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CBlockTreeDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
CBlockTreeDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false);
|
||||||
|
Loading…
Reference in New Issue
Block a user