diff options
Diffstat (limited to 'src/blockchain_db/berkeleydb')
-rw-r--r-- | src/blockchain_db/berkeleydb/db_bdb.cpp | 8 | ||||
-rw-r--r-- | src/blockchain_db/berkeleydb/db_bdb.h | 17 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index bfdb22a10..a7fa556bd 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -135,7 +135,7 @@ const unsigned int DB_BUFFER_LENGTH = 32 * MB; const unsigned int DB_DEF_CACHESIZE = 256 * MB; #if defined(BDB_BULK_CAN_THREAD) -const unsigned int DB_BUFFER_COUNT = std::thread::hardware_concurrency(); +const unsigned int DB_BUFFER_COUNT = boost::thread::hardware_concurrency(); #else const unsigned int DB_BUFFER_COUNT = 1; #endif @@ -2180,6 +2180,12 @@ void BlockchainBDB::get_output_tx_and_index(const uint64_t& amount, const std::v LOG_PRINT_L3("db3: " << db3); } +std::map<uint64_t, uint64_t>::BlockchainBDB::get_output_histogram(const std::vector<uint64_t> &amounts) const +{ + LOG_PRINT_L3("BlockchainBDB::" << __func__); + throw1(DB_ERROR("Not implemented.")); +} + void BlockchainBDB::set_hard_fork_starting_height(uint8_t version, uint64_t height) { LOG_PRINT_L3("BlockchainBDB::" << __func__); diff --git a/src/blockchain_db/berkeleydb/db_bdb.h b/src/blockchain_db/berkeleydb/db_bdb.h index bf9665cae..5c6bda4eb 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.h +++ b/src/blockchain_db/berkeleydb/db_bdb.h @@ -130,7 +130,7 @@ public: T acquire_buffer() { - std::unique_lock<std::mutex> lock(m_lock); + boost::unique_lock<boost::mutex> lock(m_lock); m_cv.wait(lock, [&]{ return m_count > 0; }); --m_count; @@ -154,7 +154,7 @@ public: void release_buffer(T buffer) { - std::unique_lock<std::mutex> lock(m_lock); + boost::unique_lock<boost::mutex> lock(m_lock); assert(buffer != nullptr); auto it = m_buffer_map.find(buffer); @@ -196,10 +196,10 @@ private: std::vector<T> m_buffers; std::unordered_map<T, size_t> m_buffer_map; - std::condition_variable m_cv; + boost::condition_variable m_cv; std::vector<bool> m_open_slot; size_t m_count; - std::mutex m_lock; + boost::mutex m_lock; size_t m_buffer_count; }; @@ -341,6 +341,15 @@ public: virtual bool can_thread_bulk_indices() const { return false; } #endif + /** + * @brief return a histogram of outputs on the blockchain + * + * @param amounts optional set of amounts to lookup + * + * @return a set of amount/instances + */ + std::map<uint64_t, uint64_t> get_output_histogram(const std::vector<uint64_t> &amounts) const; + private: virtual void add_block( const block& blk , const size_t& block_size |