aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities/blockchain_export.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_utilities/blockchain_export.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_utilities/blockchain_export.cpp')
-rw-r--r--src/blockchain_utilities/blockchain_export.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp
index f145bc107..82eca91b6 100644
--- a/src/blockchain_utilities/blockchain_export.cpp
+++ b/src/blockchain_utilities/blockchain_export.cpp
@@ -31,10 +31,6 @@
#include "common/command_line.h"
#include "cryptonote_core/tx_pool.h"
#include "blockchain_db/blockchain_db.h"
-#include "blockchain_db/lmdb/db_lmdb.h"
-#if defined(BERKELEY_DB)
-#include "blockchain_db/berkeleydb/db_bdb.h"
-#endif
#include "blockchain_db/db_types.h"
#include "version.h"
@@ -149,13 +145,6 @@ int main(int argc, char* argv[])
std::cerr << "Invalid database type: " << db_type << std::endl;
return 1;
}
-#if !defined(BERKELEY_DB)
- if (db_type == "berkeley")
- {
- LOG_ERROR("BerkeleyDB support disabled.");
- return false;
- }
-#endif
if (command_line::has_arg(vm, arg_output_file))
output_file_path = boost::filesystem::path(command_line::get_arg(vm, arg_output_file));
@@ -179,19 +168,8 @@ int main(int argc, char* argv[])
tx_memory_pool m_mempool(*core_storage);
core_storage = new Blockchain(m_mempool);
- int db_flags = 0;
-
- BlockchainDB* db = nullptr;
- if (db_type == "lmdb")
- {
- db_flags |= MDB_RDONLY;
- db = new BlockchainLMDB();
- }
-#if defined(BERKELEY_DB)
- else if (db_type == "berkeley")
- db = new BlockchainBDB();
-#endif
- else
+ BlockchainDB* db = new_db(db_type);
+ if (db == NULL)
{
LOG_ERROR("Attempted to use non-existent database type: " << db_type);
throw std::runtime_error("Attempting to use non-existent database type");
@@ -205,7 +183,7 @@ int main(int argc, char* argv[])
LOG_PRINT_L0("Loading blockchain from folder " << filename << " ...");
try
{
- db->open(filename, db_flags);
+ db->open(filename, DBF_RDONLY);
}
catch (const std::exception& e)
{