Kagome
Polkadot Runtime Engine in C++17
connection.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_TELEMETRY_CONNECTION_HPP
7 #define KAGOME_TELEMETRY_CONNECTION_HPP
8 
9 #include <functional>
10 #include <memory>
11 #include <string>
12 
13 #include "telemetry/endpoint.hpp"
14 
15 namespace kagome::telemetry {
16 
24  public:
34  using OnConnectedCallback =
35  std::function<void(std::shared_ptr<TelemetryConnection>)>;
36 
37  virtual ~TelemetryConnection() = default;
38 
44  virtual void connect() = 0;
45 
47  virtual const TelemetryEndpoint &endpoint() const = 0;
48 
56  virtual void send(const std::string &data) = 0;
57 
68  virtual void send(std::size_t message_handle) = 0;
69 
71  virtual bool isConnected() const = 0;
72 
74  virtual void shutdown() = 0;
75  };
76 
77 } // namespace kagome::telemetry
78 
79 #endif // KAGOME_TELEMETRY_CONNECTION_HPP
virtual const TelemetryEndpoint & endpoint() const =0
Returns the associated telemetry endpoint.
virtual bool isConnected() const =0
Get the current status of the connection.
std::function< void(std::shared_ptr< TelemetryConnection >)> OnConnectedCallback
Definition: connection.hpp:35
virtual void send(const std::string &data)=0
virtual void shutdown()=0
Request the connection to shutdown.