Kagome
Polkadot Runtime Engine in C++17
service.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_TELEMETRY_SERVICE_HPP
7 #define KAGOME_TELEMETRY_SERVICE_HPP
8 
9 #include <string>
10 
11 #include "primitives/common.hpp"
12 
13 namespace kagome::telemetry {
14 
20  enum class BlockOrigin {
22  kGenesis,
23 
26 
29 
33 
35  kOwn,
36 
38  kFile,
39  };
40 
45  public:
46  virtual ~TelemetryService() = default;
47 
54  virtual void setGenesisBlockHash(const primitives::BlockHash &hash) = 0;
55 
63  virtual void notifyWasSynchronized() = 0;
64 
70  virtual void notifyBlockImported(const primitives::BlockInfo &info,
71  BlockOrigin origin) = 0;
72 
77  virtual void notifyBlockFinalized(const primitives::BlockInfo &info) = 0;
78 
83  virtual bool isEnabled() const = 0;
84  };
85 
86  using Telemetry = std::shared_ptr<TelemetryService>;
87 
89  void setTelemetryService(Telemetry service);
90 
93 
94 } // namespace kagome::telemetry
95 
96 #endif // KAGOME_TELEMETRY_SERVICE_HPP
std::shared_ptr< TelemetryService > createTelemetryService()
Returns preliminary initialized instance of telemetry service.
Definition: service.cpp:69
Genesis block built into the client.
Block is part of the initial sync with the network.
Block was broadcasted on the network.
Block that was collated by this node.
Block was imported from a file.
void setTelemetryService(std::shared_ptr< TelemetryService > service)
Definition: service.cpp:62
std::shared_ptr< TelemetryService > Telemetry
Definition: service.hpp:86