6 #ifndef KAGOME_CORE_METRICS_IMPL_SESSION_IMPL_HPP 7 #define KAGOME_CORE_METRICS_IMPL_SESSION_IMPL_HPP 11 #include <boost/asio/strand.hpp> 12 #include <boost/beast.hpp> 19 public std::enable_shared_from_this<SessionImpl> {
20 using Body = boost::beast::http::string_body;
21 using Request = boost::beast::http::request<Body>;
22 using Response = boost::beast::http::response<Body>;
23 using Parser = boost::beast::http::request_parser<Body>;
43 void start()
override;
87 void onRead(boost::system::error_code ec, std::size_t size);
92 void onWrite(
bool close, boost::system::error_code ec, std::size_t);
99 void reportError(boost::system::error_code ec, std::string_view message);
104 boost::asio::strand<boost::asio::io_context::executor_type>
strand_;
121 #endif // KAGOME_CORE_METRICS_IMPL_SESSION_IMPL_HPP SessionImpl(Context &context, Configuration config)
constructor
boost::beast::http::error HttpError
boost::beast::http::field HttpField
boost::beast::flat_buffer buffer_
read buffer
SessionId id() const override
method to get id of the session
void reportError(boost::system::error_code ec, std::string_view message)
reports error code and message
void asyncRead()
asynchronously read http message
boost::beast::http::string_body Body
void start() override
starts session
session interface for OpenMetrics service
boost::beast::http::request_parser< Body > Parser
boost::asio::strand< boost::asio::io_context::executor_type > strand_
Strand to ensure the connection's handlers are not called concurrently.
boost::beast::tcp_stream stream_
stream
static constexpr boost::string_view kServerName
boost::asio::io_context Context
void respond(Response response) override
sends response wrapped by http message
boost::beast::http::response< Body > Response
void asyncWrite(Response message)
sends http message
Socket & socket() override
std::shared_ptr< soralog::Logger > Logger
~SessionImpl() override=default
std::unique_ptr< Parser > parser_
request parser type
std::shared_ptr< void > res_
boost::beast::http::request< Body > Request
void onWrite(bool close, boost::system::error_code ec, std::size_t)
write completion callback
void onRead(boost::system::error_code ec, std::size_t size)
read completion callback
boost::asio::ip::tcp::socket Socket
Configuration config_
session configuration
void handleRequest(Request &&request)
process http request, compose and execute response