From 262ef473db6d597e4d0e80ca4ea412a3d0282729 Mon Sep 17 00:00:00 2001 From: jeffro256 Date: Thu, 11 Apr 2024 12:12:35 -0500 Subject: [PATCH] BlockchainDB: remove lock/unlock methods --- src/blockchain_db/blockchain_db.h | 35 ------------------------------ src/blockchain_db/lmdb/db_lmdb.cpp | 16 -------------- src/blockchain_db/lmdb/db_lmdb.h | 4 ---- src/blockchain_db/testdb.h | 2 -- 4 files changed, 57 deletions(-) diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 9628a5c4d..540e56f8d 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -718,41 +718,6 @@ public: */ virtual std::string get_db_name() const = 0; - - // FIXME: these are just for functionality mocking, need to implement - // RAII-friendly and multi-read one-write friendly locking mechanism - // - // acquire db lock - /** - * @brief acquires the BlockchainDB lock - * - * This function is a stub until such a time as locking is implemented at - * this level. - * - * The subclass implementation should return true unless implementing a - * locking scheme of some sort, in which case it should return true upon - * acquisition of the lock and block until then. - * - * If any of this cannot be done, the subclass should throw the corresponding - * subclass of DB_EXCEPTION - * - * @return true, unless at a future time false makes sense (timeout, etc) - */ - virtual bool lock() = 0; - - // release db lock - /** - * @brief This function releases the BlockchainDB lock - * - * The subclass, should it have implemented lock(), will release any lock - * held by the calling thread. In the case of recursive locking, it should - * release one instance of a lock. - * - * If any of this cannot be done, the subclass should throw the corresponding - * subclass of DB_EXCEPTION - */ - virtual void unlock() = 0; - /** * @brief tells the BlockchainDB to start a new "batch" of blocks * diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 2c015faee..db8c68c45 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -1688,22 +1688,6 @@ std::string BlockchainLMDB::get_db_name() const return std::string("lmdb"); } -// TODO: this? -bool BlockchainLMDB::lock() -{ - LOG_PRINT_L3("BlockchainLMDB::" << __func__); - check_open(); - return false; -} - -// TODO: this? -void BlockchainLMDB::unlock() -{ - LOG_PRINT_L3("BlockchainLMDB::" << __func__); - check_open(); -} - - // The below two macros are for DB access within block add/remove, whether // regular batch txn is in use or not. m_write_txn is used as a batch txn, even // if it's only within block add/remove. diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h index 95e7b2aa4..dd0a5d30b 100644 --- a/src/blockchain_db/lmdb/db_lmdb.h +++ b/src/blockchain_db/lmdb/db_lmdb.h @@ -202,10 +202,6 @@ public: virtual std::string get_db_name() const; - virtual bool lock(); - - virtual void unlock(); - virtual bool block_exists(const crypto::hash& h, uint64_t *height = NULL) const; virtual uint64_t get_block_height(const crypto::hash& h) const; diff --git a/src/blockchain_db/testdb.h b/src/blockchain_db/testdb.h index a27183b2c..96b069772 100644 --- a/src/blockchain_db/testdb.h +++ b/src/blockchain_db/testdb.h @@ -50,8 +50,6 @@ public: virtual std::vector get_filenames() const override { return std::vector(); } virtual bool remove_data_file(const std::string& folder) const override { return true; } virtual std::string get_db_name() const override { return std::string(); } - virtual bool lock() override { return true; } - virtual void unlock() override { } virtual bool batch_start(uint64_t batch_num_blocks=0, uint64_t batch_bytes=0) override { return true; } virtual void batch_stop() override {} virtual void batch_abort() override {}