Optionally allow DB to know expected number of blocks at batch transaction start

This will assist in a DB resize check.
This commit is contained in:
warptangent 2015-07-11 12:28:20 -07:00
parent 2cd4d7dd20
commit 6e170c8b78
No known key found for this signature in database
GPG Key ID: 0E490BEBFBE4E92D
6 changed files with 8 additions and 8 deletions

View File

@ -1595,7 +1595,7 @@ bool BlockchainBDB::has_key_image(const crypto::key_image& img) const
// Ostensibly BerkeleyDB has batch transaction support built-in, // Ostensibly BerkeleyDB has batch transaction support built-in,
// so the following few functions will be NOP. // so the following few functions will be NOP.
void BlockchainBDB::batch_start() void BlockchainBDB::batch_start(uint64_t batch_num_blocks)
{ {
LOG_PRINT_L3("BlockchainBDB::" << __func__); LOG_PRINT_L3("BlockchainBDB::" << __func__);
} }

View File

@ -191,7 +191,7 @@ public:
); );
virtual void set_batch_transactions(bool batch_transactions); virtual void set_batch_transactions(bool batch_transactions);
virtual void batch_start(); virtual void batch_start(uint64_t batch_num_blocks=0);
virtual void batch_commit(); virtual void batch_commit();
virtual void batch_stop(); virtual void batch_stop();
virtual void batch_abort(); virtual void batch_abort();

View File

@ -357,7 +357,7 @@ public:
// release db lock // release db lock
virtual void unlock() = 0; virtual void unlock() = 0;
virtual void batch_start() = 0; virtual void batch_start(uint64_t batch_num_blocks=0) = 0;
virtual void batch_stop() = 0; virtual void batch_stop() = 0;
virtual void set_batch_transactions(bool) = 0; virtual void set_batch_transactions(bool) = 0;

View File

@ -1820,7 +1820,7 @@ bool BlockchainLMDB::has_key_image(const crypto::key_image& img) const
return false; return false;
} }
void BlockchainLMDB::batch_start() void BlockchainLMDB::batch_start(uint64_t batch_num_blocks)
{ {
LOG_PRINT_L3("BlockchainLMDB::" << __func__); LOG_PRINT_L3("BlockchainLMDB::" << __func__);
if (! m_batch_transactions) if (! m_batch_transactions)

View File

@ -191,7 +191,7 @@ public:
); );
virtual void set_batch_transactions(bool batch_transactions); virtual void set_batch_transactions(bool batch_transactions);
virtual void batch_start(); virtual void batch_start(uint64_t batch_num_blocks=0);
virtual void batch_commit(); virtual void batch_commit();
virtual void batch_stop(); virtual void batch_stop();
virtual void batch_abort(); virtual void batch_abort();

View File

@ -96,9 +96,9 @@ struct fake_core_lmdb
return m_storage.get_db().add_block(blk, block_size, cumulative_difficulty, coins_generated, txs); return m_storage.get_db().add_block(blk, block_size, cumulative_difficulty, coins_generated, txs);
} }
void batch_start() void batch_start(uint64_t batch_num_blocks = 0)
{ {
m_storage.get_db().batch_start(); m_storage.get_db().batch_start(batch_num_blocks);
} }
void batch_stop() void batch_stop()
@ -150,7 +150,7 @@ struct fake_core_memory
return 2; return 2;
} }
void batch_start() void batch_start(uint64_t batch_num_blocks = 0)
{ {
LOG_PRINT_L0("WARNING: [batch_start] opt_batch set, but this database doesn't support/need transactions - ignoring"); LOG_PRINT_L0("WARNING: [batch_start] opt_batch set, but this database doesn't support/need transactions - ignoring");
} }