mirror of
https://github.com/monero-project/monero.git
synced 2024-12-27 06:49:26 -05:00
Merge pull request #4013
e5592c4
rpc: add blockchain disk size to getinfo (moneromooo-monero)
This commit is contained in:
commit
3e026ff6ed
@ -1565,6 +1565,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool is_read_only() const = 0;
|
virtual bool is_read_only() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get disk space requirements
|
||||||
|
*
|
||||||
|
* @return the size required
|
||||||
|
*/
|
||||||
|
virtual uint64_t get_database_size() const = 0;
|
||||||
|
|
||||||
// TODO: this should perhaps be (or call) a series of functions which
|
// TODO: this should perhaps be (or call) a series of functions which
|
||||||
// progressively update through version updates
|
// progressively update through version updates
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "string_tools.h"
|
#include "string_tools.h"
|
||||||
|
#include "file_io_utils.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||||
#include "crypto/crypto.h"
|
#include "crypto/crypto.h"
|
||||||
@ -3500,6 +3501,16 @@ bool BlockchainLMDB::is_read_only() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t BlockchainLMDB::get_database_size() const
|
||||||
|
{
|
||||||
|
uint64_t size = 0;
|
||||||
|
boost::filesystem::path datafile(m_folder);
|
||||||
|
datafile /= CRYPTONOTE_BLOCKCHAINDATA_FILENAME;
|
||||||
|
if (!epee::file_io_utils::get_file_size(datafile.string(), size))
|
||||||
|
size = 0;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
void BlockchainLMDB::fixup()
|
void BlockchainLMDB::fixup()
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
|
@ -380,6 +380,8 @@ private:
|
|||||||
|
|
||||||
virtual bool is_read_only() const;
|
virtual bool is_read_only() const;
|
||||||
|
|
||||||
|
virtual uint64_t get_database_size() const;
|
||||||
|
|
||||||
// fix up anything that may be wrong due to past bugs
|
// fix up anything that may be wrong due to past bugs
|
||||||
virtual void fixup();
|
virtual void fixup();
|
||||||
|
|
||||||
|
@ -207,6 +207,7 @@ namespace cryptonote
|
|||||||
boost::shared_lock<boost::shared_mutex> lock(m_bootstrap_daemon_mutex);
|
boost::shared_lock<boost::shared_mutex> lock(m_bootstrap_daemon_mutex);
|
||||||
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
|
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
|
||||||
}
|
}
|
||||||
|
res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1641,6 +1642,7 @@ namespace cryptonote
|
|||||||
boost::shared_lock<boost::shared_mutex> lock(m_bootstrap_daemon_mutex);
|
boost::shared_lock<boost::shared_mutex> lock(m_bootstrap_daemon_mutex);
|
||||||
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
|
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
|
||||||
}
|
}
|
||||||
|
res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -967,6 +967,7 @@ namespace cryptonote
|
|||||||
std::string bootstrap_daemon_address;
|
std::string bootstrap_daemon_address;
|
||||||
uint64_t height_without_bootstrap;
|
uint64_t height_without_bootstrap;
|
||||||
bool was_bootstrap_ever_used;
|
bool was_bootstrap_ever_used;
|
||||||
|
uint64_t database_size;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(status)
|
KV_SERIALIZE(status)
|
||||||
@ -997,6 +998,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(bootstrap_daemon_address)
|
KV_SERIALIZE(bootstrap_daemon_address)
|
||||||
KV_SERIALIZE(height_without_bootstrap)
|
KV_SERIALIZE(height_without_bootstrap)
|
||||||
KV_SERIALIZE(was_bootstrap_ever_used)
|
KV_SERIALIZE(was_bootstrap_ever_used)
|
||||||
|
KV_SERIALIZE(database_size)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -126,6 +126,7 @@ public:
|
|||||||
virtual void remove_txpool_tx(const crypto::hash& txid) {}
|
virtual void remove_txpool_tx(const crypto::hash& txid) {}
|
||||||
virtual bool get_txpool_tx_meta(const crypto::hash& txid, txpool_tx_meta_t &meta) const { return false; }
|
virtual bool get_txpool_tx_meta(const crypto::hash& txid, txpool_tx_meta_t &meta) const { return false; }
|
||||||
virtual bool get_txpool_tx_blob(const crypto::hash& txid, cryptonote::blobdata &bd) const { return false; }
|
virtual bool get_txpool_tx_blob(const crypto::hash& txid, cryptonote::blobdata &bd) const { return false; }
|
||||||
|
virtual uint64_t get_database_size() const { return 0; }
|
||||||
virtual cryptonote::blobdata get_txpool_tx_blob(const crypto::hash& txid) const { return ""; }
|
virtual cryptonote::blobdata get_txpool_tx_blob(const crypto::hash& txid) const { return ""; }
|
||||||
virtual bool for_all_txpool_txes(std::function<bool(const crypto::hash&, const txpool_tx_meta_t&, const cryptonote::blobdata*)>, bool include_blob = false, bool include_unrelayed_txes = false) const { return false; }
|
virtual bool for_all_txpool_txes(std::function<bool(const crypto::hash&, const txpool_tx_meta_t&, const cryptonote::blobdata*)>, bool include_blob = false, bool include_unrelayed_txes = false) const { return false; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user