aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.cpp
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2017-08-20 13:37:19 +0100
committerHoward Chu <hyc@symas.com>2017-08-20 13:57:36 +0100
commit80344740bdd3c61c39a8bcac67a4858549eab505 (patch)
tree62155f343bd3367b1085e81569bf91d9d7852428 /src/blockchain_db/blockchain_db.cpp
parentDB cleanup (diff)
downloadmonero-80344740bdd3c61c39a8bcac67a4858549eab505.tar.xz
More DB support cleanup
Hide DB types from db_types.h - no reason to recompile dependencies when DB types change. Also remove lingering in-memory DB references, they've been obsolete since 9e82b694da120708652871b55f639d1ef306a7ec
Diffstat (limited to 'src/blockchain_db/blockchain_db.cpp')
-rw-r--r--src/blockchain_db/blockchain_db.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index c7ca533ef..01a59e079 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -38,6 +38,14 @@
#include "berkeleydb/db_bdb.h"
#endif
+static const char *db_types[] = {
+ "lmdb",
+#ifdef BERKELEY_DB
+ "berkeley",
+#endif
+ NULL
+};
+
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "blockchain.db"
@@ -46,6 +54,30 @@ using epee::string_tools::pod_to_hex;
namespace cryptonote
{
+bool blockchain_valid_db_type(const std::string& db_type)
+{
+ int i;
+ for (i=0; db_types[i]; i++)
+ {
+ if (db_types[i] == db_type)
+ return true;
+ }
+ return false;
+}
+
+std::string blockchain_db_types(const std::string& sep)
+{
+ int i;
+ std::string ret = "";
+ for (i=0; db_types[i]; i++)
+ {
+ if (i)
+ ret += sep;
+ ret += db_types[i];
+ }
+ return ret;
+}
+
BlockchainDB *new_db(const std::string& db_type)
{
if (db_type == "lmdb")