aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_converter/blockchain_export.h
diff options
context:
space:
mode:
authorwarptangent <warptangent@inbox.com>2015-03-16 11:57:26 -0700
committerwarptangent <warptangent@inbox.com>2015-03-16 11:57:26 -0700
commitffadb6571a3c3b1d5365d682304a98cee79c68c8 (patch)
treeccabab858194ed9c443a9c9a0d46ae33852ed5aa /src/blockchain_converter/blockchain_export.h
parentAdd blockchain_export utility (diff)
downloadmonero-ffadb6571a3c3b1d5365d682304a98cee79c68c8.tar.xz
blockchain_export: Add compile-time support for BlockchainDB
This allows an LMDB database to be used as the blockchain to export. Adjust SOURCE_DB in src/blockchain_converter/blockchain_export.h depending on needs. Defaults to DB_MEMORY. DB_MEMORY is a sensible default for users migrating to LMDB, as it allows the exporter to use the in-memory blockchain while the other binaries work with LMDB, without recompiling anything.
Diffstat (limited to 'src/blockchain_converter/blockchain_export.h')
-rw-r--r--src/blockchain_converter/blockchain_export.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/blockchain_converter/blockchain_export.h b/src/blockchain_converter/blockchain_export.h
index cd79d1c47..43e25c039 100644
--- a/src/blockchain_converter/blockchain_export.h
+++ b/src/blockchain_converter/blockchain_export.h
@@ -35,27 +35,40 @@
#include "cryptonote_core/cryptonote_basic.h"
#include "cryptonote_core/blockchain_storage.h"
#include "cryptonote_core/blockchain.h"
-// TODO:
#include "blockchain_db/blockchain_db.h"
#include "blockchain_db/lmdb/db_lmdb.h"
+// CONFIG: choose one of the three #define's
+//
+// DB_MEMORY is a sensible default for users migrating to LMDB, as it allows
+// the exporter to use the in-memory blockchain while the other binaries
+// work with LMDB, without recompiling anything.
+//
+#define SOURCE_DB DB_MEMORY
+// #define SOURCE_DB DB_LMDB
+// to use global compile-time setting (DB_MEMORY or DB_LMDB):
+// #define SOURCE_DB BLOCKCHAIN_DB
+
using namespace cryptonote;
class BlockchainExport
{
public:
- bool store_blockchain_raw(cryptonote::blockchain_storage* cs, cryptonote::tx_memory_pool* txp,
+#if SOURCE_DB == DB_MEMORY
+ bool store_blockchain_raw(cryptonote::blockchain_storage* cs, cryptonote::tx_memory_pool* txp,
boost::filesystem::path& output_dir, uint64_t use_block_height=0);
- //
- // BlockchainDB:
- // bool store_blockchain_raw(cryptonote::BlockchainDB* cs, boost::filesystem::path& output_dir, uint64_t use_block_height=0);
+#else
+ bool store_blockchain_raw(cryptonote::Blockchain* cs, cryptonote::tx_memory_pool* txp,
+ boost::filesystem::path& output_dir, uint64_t use_block_height=0);
+#endif
protected:
- // blockchain_storage:
+#if SOURCE_DB == DB_MEMORY
blockchain_storage* m_blockchain_storage;
- //
- // BlockchainDB:
- // BlockchainDB* m_blockchain_storage;
+#else
+ Blockchain* m_blockchain_storage;
+#endif
+
tx_memory_pool* m_tx_pool;
typedef std::vector<char> buffer_type;
std::ofstream * m_raw_data_file;