aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.cpp
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2017-08-19 15:27:13 +0100
committerHoward Chu <hyc@symas.com>2017-08-19 18:11:38 +0100
commit4c7f8ac04f8693c321f4143e61e7511f200cab1d (patch)
tree2acc8e82b7969f4ae486fdc7a60cdb5ad21073e1 /src/blockchain_db/blockchain_db.cpp
parentMerge pull request #2303 (diff)
downloadmonero-4c7f8ac04f8693c321f4143e61e7511f200cab1d.tar.xz
DB cleanup
Hide LMDB-specific stuff behind blockchain_db.h. Nobody besides blockchain_db.cpp should ever be including DB-specific headers any more.
Diffstat (limited to 'src/blockchain_db/blockchain_db.cpp')
-rw-r--r--src/blockchain_db/blockchain_db.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index a6774a25c..c7ca533ef 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -33,6 +33,11 @@
#include "profile_tools.h"
#include "ringct/rctOps.h"
+#include "lmdb/db_lmdb.h"
+#ifdef BERKELEY_DB
+#include "berkeleydb/db_bdb.h"
+#endif
+
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "blockchain.db"
@@ -41,6 +46,17 @@ using epee::string_tools::pod_to_hex;
namespace cryptonote
{
+BlockchainDB *new_db(const std::string& db_type)
+{
+ if (db_type == "lmdb")
+ return new BlockchainLMDB();
+#if defined(BERKELEY_DB)
+ if (db_type == "berkeley")
+ return new BlockchainBDB();
+#endif
+ return NULL;
+}
+
void BlockchainDB::pop_block()
{
block blk;