diff options
author | Thomas Winget <tewinget@gmail.com> | 2015-02-23 18:24:59 -0500 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2015-02-23 18:24:59 -0500 |
commit | b5796da0fa67269ed218cdd14ef9f3b548fd6507 (patch) | |
tree | a64104230bd0d8ddfac59d119de7fd36dc4f48e6 /src/cryptonote_core/blockchain_db.h | |
parent | Merge pull request #31 from warptangent/fix/fix_get_tail_id (diff) | |
parent | BlockchainLMDB: Add profiling to tx_exists() (diff) | |
download | monero-b5796da0fa67269ed218cdd14ef9f3b548fd6507.tar.xz |
Merge #32
Add support to BlockchainDB and BlockchainLMDB for batch transactions.
Add profiling to block and tx processing and DB operations.
Improve block and tx processing efficiency by less repeat hashing.
Move LMDB storage to "lmdb" subfolder.
- Upon startup, if old LMDB files are detected, abort with a message for the user to move them to subfolder or delete them.
Update and fix log statements and formatting.
Diffstat (limited to 'src/cryptonote_core/blockchain_db.h')
-rw-r--r-- | src/cryptonote_core/blockchain_db.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain_db.h b/src/cryptonote_core/blockchain_db.h index db56c7c07..2a7fa8f82 100644 --- a/src/cryptonote_core/blockchain_db.h +++ b/src/cryptonote_core/blockchain_db.h @@ -265,13 +265,14 @@ private: , const size_t& block_size , const difficulty_type& cumulative_difficulty , const uint64_t& coins_generated + , const crypto::hash& blk_hash ) = 0; // tells the subclass to remove data about the top block virtual void remove_block() = 0; // tells the subclass to store the transaction and its metadata - virtual void add_transaction_data(const crypto::hash& blk_hash, const transaction& tx) = 0; + virtual void add_transaction_data(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash& tx_hash) = 0; // tells the subclass to remove data about a transaction virtual void remove_transaction_data(const crypto::hash& tx_hash, const transaction& tx) = 0; @@ -296,17 +297,33 @@ private: void pop_block(); // helper function for add_transactions, to add each individual tx - void add_transaction(const crypto::hash& blk_hash, const transaction& tx); + void add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr = NULL); // helper function to remove transaction from blockchain void remove_transaction(const crypto::hash& tx_hash); + uint64_t num_calls = 0; + uint64_t time_blk_hash = 0; + uint64_t time_add_block1 = 0; + uint64_t time_add_transaction = 0; + + +protected: + + mutable uint64_t time_tx_exists = 0; + uint64_t time_commit1 = 0; + public: // virtual dtor virtual ~BlockchainDB() { }; + // reset profiling stats + void reset_stats(); + + // show profiling stats + void show_stats(); // open the db at location <filename>, or create it if there isn't one. virtual void open(const std::string& filename) = 0; @@ -336,6 +353,9 @@ public: // release db lock virtual void unlock() = 0; + virtual void batch_start() = 0; + virtual void batch_stop() = 0; + virtual void set_batch_transactions(bool) = 0; // adds a block with the given metadata to the top of the blockchain, returns the new height // NOTE: subclass implementations of this (or the functions it calls) need |