userver: userver/server/handlers/restart.hpp Source File
Loading...
Searching...
No Matches
restart.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/server/handlers/restart.hpp
4/// @brief @copybrief server::handlers::Restart
5
6#include <atomic>
7
8#include <userver/server/handlers/http_handler_base.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace server::handlers {
13
14/// @ingroup userver_components userver_http_handlers
15///
16/// @brief Handler that stops the service. It is expected that an external system
17/// (e.g. systemd or supervisord) restarts the service afterwards.
18///
19/// The handler uses monitor port.
20///
21/// The component has no service configuration except the
22/// @ref userver_http_handlers "common handler options".
23class Restart final : public HttpHandlerBase {
24public:
25 Restart(const components::ComponentConfig&, const components::ComponentContext&);
26
27 /// @ingroup userver_component_names
28 /// @brief The default name of server::handlers::Restart
29 static constexpr std::string_view kName = "handler-restart";
30
31 std::string HandleRequestThrow(const http::HttpRequest&, request::RequestContext&) const override;
32
34
35private:
36 mutable std::atomic<components::ComponentHealth> health_;
37};
38
39} // namespace server::handlers
40
41USERVER_NAMESPACE_END