Making collect_container_info a member of nano::ledger.

This commit is contained in:
Colin LeMahieu 2024-03-29 22:11:51 +00:00
commit cc20a5b163
No known key found for this signature in database
GPG key ID: 43708520C8DFB938
5 changed files with 8 additions and 9 deletions

View file

@ -554,7 +554,7 @@ std::unique_ptr<nano::container_info_component> nano::collect_container_info (no
{
auto composite = std::make_unique<container_info_composite> (name);
composite->add_component (collect_container_info (node.work, "work"));
composite->add_component (collect_container_info (node.ledger, "ledger"));
composite->add_component (node.ledger.collect_container_info ("ledger"));
composite->add_component (collect_container_info (node.active, "active"));
composite->add_component (collect_container_info (node.bootstrap_initiator, "bootstrap_initiator"));
composite->add_component (node.tcp_listener->collect_container_info ("tcp_listener"));

View file

@ -1605,12 +1605,12 @@ nano::uncemented_info::uncemented_info (nano::block_hash const & cemented_fronti
{
}
std::unique_ptr<nano::container_info_component> nano::collect_container_info (ledger & ledger, std::string const & name)
std::unique_ptr<nano::container_info_component> nano::ledger::collect_container_info (std::string const & name) const
{
auto count = ledger.bootstrap_weights.size ();
auto sizeof_element = sizeof (decltype (ledger.bootstrap_weights)::value_type);
auto count = bootstrap_weights.size ();
auto sizeof_element = sizeof (decltype (bootstrap_weights)::value_type);
auto composite = std::make_unique<container_info_composite> (name);
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "bootstrap_weights", count, sizeof_element }));
composite->add_component (ledger.cache.rep_weights.collect_container_info ("rep_weights"));
composite->add_component (cache.rep_weights.collect_container_info ("rep_weights"));
return composite;
}

View file

@ -103,6 +103,7 @@ public:
nano::receivable_iterator receivable_upper_bound (store::transaction const & tx, nano::account const & account) const;
// Returns the next receivable entry for the account 'account' with hash greater than 'hash'
nano::receivable_iterator receivable_upper_bound (store::transaction const & tx, nano::account const & account, nano::block_hash const & hash) const;
std::unique_ptr<container_info_component> collect_container_info (std::string const & name) const;
static nano::uint128_t const unit;
nano::ledger_constants & constants;
nano::store::component & store;
@ -119,6 +120,4 @@ private:
void initialize (nano::generate_cache_flags const &);
void confirm (nano::store::write_transaction const & transaction, nano::block const & block);
};
std::unique_ptr<container_info_component> collect_container_info (ledger & ledger, std::string const & name);
}

View file

@ -126,7 +126,7 @@ std::size_t nano::rep_weights::size () const
return rep_amounts.size ();
}
std::unique_ptr<nano::container_info_component> nano::rep_weights::collect_container_info (std::string const & name)
std::unique_ptr<nano::container_info_component> nano::rep_weights::collect_container_info (std::string const & name) const
{
size_t rep_amounts_count;

View file

@ -29,7 +29,7 @@ public:
/* Only use this method when loading rep weights from the database table */
void copy_from (rep_weights & other_a);
size_t size () const;
std::unique_ptr<container_info_component> collect_container_info (std::string const &);
std::unique_ptr<container_info_component> collect_container_info (std::string const &) const;
private:
mutable nano::mutex mutex;