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// clang-format off
15
16/// @ingroup userver_components userver_http_handlers
17///
18/// @brief Handler that stops the service. It is expected that an external system
19/// (e.g. systemd or supervisord) restarts the service afterwards.
20///
21/// The handler uses monitor port.
22///
23/// The component has no service configuration except the
24/// @ref userver_http_handlers "common handler options".
25
26// clang-format on
27
28class Restart final : public HttpHandlerBase {
29public:
30 Restart(const components::ComponentConfig&, const components::ComponentContext&);
31
32 /// @ingroup userver_component_names
33 /// @brief The default name of server::handlers::Restart
34 static constexpr std::string_view kName = "handler-restart";
35
36 std::string HandleRequestThrow(const http::HttpRequest&, request::RequestContext&) const override;
37
39
40private:
41 mutable std::atomic<components::ComponentHealth> health_;
42};
43
44} // namespace server::handlers
45
46USERVER_NAMESPACE_END