userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
common_component.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/client/common_component.hpp
4
/// @brief @copybrief ugrpc::client::CommonComponent
5
6
#
include
<
optional
>
7
8
#
include
<
userver
/
components
/
component_base
.
hpp
>
9
#
include
<
userver
/
engine
/
task
/
task_processor_fwd
.
hpp
>
10
11
#
include
<
userver
/
ugrpc
/
client
/
impl
/
completion_queue_pool
.
hpp
>
12
#
include
<
userver
/
ugrpc
/
client
/
proxy_settings
.
hpp
>
13
#
include
<
userver
/
ugrpc
/
impl
/
completion_queue_pool_base
.
hpp
>
14
#
include
<
userver
/
ugrpc
/
impl
/
statistics_storage
.
hpp
>
15
16
USERVER_NAMESPACE_BEGIN
17
18
namespace
ugrpc::client {
19
20
/// @ingroup userver_components
21
///
22
/// @brief Contains common machinery that's required for all ugrpc clients
23
///
24
/// ## Static options of ugrpc::client::CommonComponent :
25
/// @include{doc} scripts/docs/en/components_schema/grpc/src/ugrpc/client/common_component.md
26
///
27
/// Options inherited from @ref components::ComponentBase :
28
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
29
///
30
/// The component name for static config is `"grpc-client-common"`.
31
///
32
/// @see ugrpc::client::ClientFactoryComponent
33
class
CommonComponent
final
:
public
components
::
ComponentBase
{
34
public
:
35
/// @ingroup userver_component_names
36
/// @brief The default name of @ref ugrpc::client::CommonComponent
37
static
constexpr
std::string_view
kName
=
"grpc-client-common"
;
38
39
CommonComponent(
const
components
::ComponentConfig& config,
const
components
::ComponentContext& context);
40
~CommonComponent()
override
;
41
42
static
yaml_config::Schema GetStaticConfigSchema();
43
44
private
:
45
friend
class
ClientFactoryComponent;
46
47
engine::TaskProcessor& blocking_task_processor_;
48
std::optional<impl::CompletionQueuePool> client_completion_queues_;
49
ugrpc::impl::CompletionQueuePoolBase& completion_queues_;
50
ugrpc::impl::StatisticsStorage client_statistics_storage_;
51
ProxySettings
proxy_settings_;
52
// Deliberately only the *name* of the shared default retry-limiter component, not a pointer to the component
53
// itself: looking the component up eagerly here (in CommonComponent's own constructor) would force its
54
// construction for every ClientFactoryComponent that uses this CommonComponent, including "light"
55
// (use-constant-dynamic-configs) factories, for which this is typically undesired (see
56
// ugrpc::client::ClientFactoryComponent's documentation). The actual lookup is deferred to each
57
// ClientFactoryComponent's own constructor -- see FindRetryLimiterFactory in client_factory_component.cpp.
58
std::optional<std::string> retry_limiter_factory_name_;
59
};
60
61
}
// namespace ugrpc::client
62
63
template
<>
64
inline
constexpr
bool
components
::kHasValidate<ugrpc::client::CommonComponent> =
true
;
65
66
USERVER_NAMESPACE_END
userver
ugrpc
client
common_component.hpp
Generated on
for userver by
Doxygen
1.17.0