Add compile-time support for both db implementations: in-memory and LMDB

Usage:

default is lmdb for blockchain branch:
$ make release

same as:
$ DATABASE=lmdb make release

for original in-memory implementation:
$ DATABASE=memory make release
This commit is contained in:
warptangent
2015-01-25 21:36:09 -08:00
parent a4f5344024
commit 84fe5fbd65
9 changed files with 77 additions and 4 deletions
+8
View File
@@ -51,7 +51,11 @@ namespace cryptonote
//-----------------------------------------------------------------------------------------------
core::core(i_cryptonote_protocol* pprotocol):
m_mempool(m_blockchain_storage),
#if BLOCKCHAIN_DB == DB_LMDB
m_blockchain_storage(m_mempool),
#else
m_blockchain_storage(&m_mempool),
#endif
m_miner(this),
m_miner_address(boost::value_initialized<account_public_address>()),
m_starter_message_showed(false),
@@ -577,7 +581,11 @@ namespace cryptonote
m_starter_message_showed = true;
}
#if BLOCKCHAIN_DB == DB_LMDB
m_store_blockchain_interval.do_call(boost::bind(&Blockchain::store_blockchain, &m_blockchain_storage));
#else
m_store_blockchain_interval.do_call(boost::bind(&blockchain_storage::store_blockchain, &m_blockchain_storage));
#endif
m_miner.on_idle();
m_mempool.on_idle();
return true;