8 #include <boost/assert.hpp> 14 class TelemetryInstanceProxy :
public TelemetryService {
18 service_->setGenesisBlockHash(hash);
25 service_->notifyBlockImported(info, origin);
30 service_->notifyBlockFinalized(info);
33 void notifyWasSynchronized()
override {
35 service_->notifyWasSynchronized();
37 was_synchronized_ =
true;
39 bool isEnabled()
const override {
43 void setActualImplementation(
Telemetry service) {
44 service_ = std::move(service);
45 if (was_synchronized_) {
46 service_->notifyWasSynchronized();
48 service_->setGenesisBlockHash(genesis_hash_);
52 bool was_synchronized_ =
false;
58 std::shared_ptr<TelemetryInstanceProxy> telemetry_service_;
63 if (not telemetry_service_) {
64 telemetry_service_ = std::make_shared<TelemetryInstanceProxy>();
66 telemetry_service_->setActualImplementation(std::move(service));
70 if (not telemetry_service_) {
71 telemetry_service_ = std::make_shared<TelemetryInstanceProxy>();
73 return telemetry_service_;
std::shared_ptr< TelemetryService > createTelemetryService()
Returns preliminary initialized instance of telemetry service.
common::Hash256 BlockHash
detail::BlockInfoT< struct BlockInfoTag > BlockInfo
void setTelemetryService(std::shared_ptr< TelemetryService > service)
std::shared_ptr< TelemetryService > Telemetry