userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
server_component.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/server/server_component.hpp
4
/// @brief @copybrief ugrpc::server::ServerComponent
5
6
#
include
<
userver
/
components
/
component_base
.
hpp
>
7
8
#
include
<
userver
/
ugrpc
/
server
/
server
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
ugrpc::server {
13
14
namespace
impl {
15
struct
ServiceDefaults;
16
}
// namespace impl
17
18
/// @ingroup userver_components
19
///
20
/// @brief Component that configures and manages the gRPC server.
21
///
22
/// ## Static options of ugrpc::server::ServerComponent :
23
/// @include{doc} scripts/docs/en/components_schema/grpc/src/ugrpc/server/server_component.md
24
///
25
/// Options inherited from @ref components::ComponentBase :
26
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
27
///
28
/// The component name for static config is `"grpc-server"`.
29
///
30
/// @see https://grpc.github.io/grpc/core/group__grpc__arg__keys.html
31
class
ServerComponent
final
:
public
components
::
ComponentBase
{
32
public
:
33
/// @ingroup userver_component_names
34
/// @brief The default name of ugrpc::server::ServerComponent
35
static
constexpr
std::string_view
kName
=
"grpc-server"
;
36
37
ServerComponent(
const
components
::ComponentConfig& config,
const
components
::ComponentContext& context);
38
39
~ServerComponent()
override
;
40
41
/// @returns The contained Server instance
42
/// @note All configuration must be performed at the components loading stage
43
Server&
GetServer
()
noexcept
;
44
45
/// @cond
46
ServiceConfig ParseServiceConfig(
47
const
components
::ComponentConfig& config,
48
const
components
::ComponentContext& context
49
);
50
/// @endcond
51
52
static
yaml_config::Schema GetStaticConfigSchema();
53
54
private
:
55
void
OnAllComponentsLoaded()
override
;
56
57
void
OnGracefulShutdown(engine::Deadline serving_shutdown_deadline)
override
;
58
59
void
OnAllComponentsAreStopping()
override
;
60
61
Server server_;
62
std::unique_ptr<impl::ServiceDefaults> service_defaults_;
63
};
64
65
}
// namespace ugrpc::server
66
67
template
<>
68
inline
constexpr
bool
components
::kHasValidate<ugrpc::server::ServerComponent> =
true
;
69
70
USERVER_NAMESPACE_END
userver
ugrpc
server
server_component.hpp
Generated on
for userver by
Doxygen
1.17.0