From d14bebf100aaaa25c7558eeed8b5c536da99885f Mon Sep 17 00:00:00 2001 From: James O'Beirne Date: Tue, 1 Feb 2022 16:22:00 -0500 Subject: db: add StoragePath to CDBWrapper/CCoinsViewDB This is used in subsequent commits. It allows us to clean up UTXO snapshot chainstate after background validation completes. --- src/dbwrapper.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/dbwrapper.h') diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 665eaa0e98..1052da01d5 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -39,6 +39,10 @@ public: class CDBWrapper; +namespace dbwrapper { + using leveldb::DestroyDB; +} + /** These should be considered an implementation detail of the specific database. */ namespace dbwrapper_private { @@ -219,6 +223,12 @@ private: std::vector CreateObfuscateKey() const; + //! path to filesystem storage + const fs::path m_path; + + //! whether or not the database resides in memory + bool m_is_memory; + public: /** * @param[in] path Location in the filesystem where leveldb data will be stored. @@ -268,6 +278,14 @@ public: return WriteBatch(batch, fSync); } + //! @returns filesystem path to the on-disk data. + std::optional StoragePath() { + if (m_is_memory) { + return {}; + } + return m_path; + } + template bool Exists(const K& key) const { -- cgit v1.2.3