6 #ifndef KAGOME_CORE_METRICS_SESSION_HPP 7 #define KAGOME_CORE_METRICS_SESSION_HPP 9 #include <boost/asio/io_context.hpp> 10 #include <boost/asio/ip/tcp.hpp> 11 #include <boost/asio/streambuf.hpp> 12 #include <boost/beast/http/string_body.hpp> 21 using Body = boost::beast::http::string_body;
22 using Request = boost::beast::http::request<Body>;
23 using Response = boost::beast::http::response<Body>;
25 using Socket = boost::asio::ip::tcp::socket;
28 using Duration = boost::asio::steady_timer::duration;
46 virtual void start() = 0;
56 on_request_ = std::move(callback);
74 #endif // KAGOME_CORE_METRICS_SESSION_HPP static constexpr Duration kDefaultTimeout
void connectOnRequest(std::function< OnRequestSignature > callback)
connects on request callback
void processRequest(Request request, std::shared_ptr< Session > session)
process request message
boost::beast::http::request< Body > Request
void(Request, std::shared_ptr< Session > session) OnRequestSignature
boost::beast::http::string_body Body
boost::system::error_code ErrorCode
session interface for OpenMetrics service
boost::asio::streambuf Streambuf
std::function< OnRequestSignature > on_request_
on request callback
virtual SessionId id() const =0
boost::asio::io_context Context
Duration operation_timeout
virtual Socket & socket()=0
static constexpr size_t kDefaultRequestSize
boost::asio::steady_timer::duration Duration
boost::beast::http::response< Body > Response
virtual void respond(Response message)=0
send response message
boost::asio::ip::tcp::socket Socket
virtual ~Session()=default