Use unique ptr for telemetry

This commit is contained in:
Piotr Wójcik 2024-09-09 22:43:13 +02:00
commit 431964cd26
6 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,7 @@
#include <nano/core_test/fakes/websocket_client.hpp>
#include <nano/lib/blocks.hpp>
#include <nano/node/active_elections.hpp>
#include <nano/node/telemetry.hpp>
#include <nano/node/transport/fake.hpp>
#include <nano/node/vote_router.hpp>
#include <nano/node/websocket.hpp>

View file

@ -2,6 +2,7 @@
#include <nano/node/bootstrap_ascending/service.hpp>
#include <nano/node/message_processor.hpp>
#include <nano/node/node.hpp>
#include <nano/node/telemetry.hpp>
nano::message_processor::message_processor (message_processor_config const & config_a, nano::node & node_a) :
config{ config_a },

View file

@ -155,7 +155,8 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
// otherwise, any value is considered, with `0` having the special meaning of 'let the OS pick a port instead'
//
network (*this, config.peering_port.has_value () ? *config.peering_port : 0),
telemetry{ flags, *this, network, observers, network_params, stats },
telemetry_impl{ std::make_unique<nano::telemetry> (flags, *this, network, observers, network_params, stats) },
telemetry{ *telemetry_impl },
bootstrap_initiator (*this),
bootstrap_server{ config.bootstrap_server, store, ledger, network_params.network, stats },
// BEWARE: `bootstrap` takes `network.port` instead of `config.peering_port` because when the user doesn't specify

View file

@ -20,7 +20,6 @@
#include <nano/node/process_live_dispatcher.hpp>
#include <nano/node/rep_tiers.hpp>
#include <nano/node/repcrawler.hpp>
#include <nano/node/telemetry.hpp>
#include <nano/node/transport/tcp_server.hpp>
#include <nano/node/unchecked_map.hpp>
#include <nano/node/vote_cache.hpp>
@ -45,6 +44,7 @@ class confirming_set;
class message_processor;
class monitor;
class node;
class telemetry;
class vote_processor;
class vote_cache_processor;
class vote_router;
@ -171,7 +171,8 @@ public:
std::unique_ptr<nano::message_processor> message_processor_impl;
nano::message_processor & message_processor;
nano::network network;
nano::telemetry telemetry;
std::unique_ptr<nano::telemetry> telemetry_impl;
nano::telemetry & telemetry;
nano::bootstrap_initiator bootstrap_initiator;
nano::bootstrap_server bootstrap_server;
std::unique_ptr<nano::transport::tcp_listener> tcp_listener_impl;

View file

@ -13,6 +13,7 @@
#include <nano/node/scheduler/component.hpp>
#include <nano/node/scheduler/manual.hpp>
#include <nano/node/scheduler/priority.hpp>
#include <nano/node/telemetry.hpp>
#include <nano/rpc/rpc.hpp>
#include <nano/rpc/rpc_request_processor.hpp>
#include <nano/rpc_test/common.hpp>

View file

@ -9,6 +9,7 @@
#include <nano/node/scheduler/component.hpp>
#include <nano/node/scheduler/manual.hpp>
#include <nano/node/scheduler/priority.hpp>
#include <nano/node/telemetry.hpp>
#include <nano/node/transport/inproc.hpp>
#include <nano/node/unchecked_map.hpp>
#include <nano/secure/ledger.hpp>