userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
component_core.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
#
ifdef
USERVER_TVM2_HTTP_CLIENT
4
#
error
Use
components
::
Http
from
clients
/
http
.
hpp
instead
5
#
endif
6
7
/// @file userver/clients/http/component_core.hpp
8
/// @brief @copybrief components::HttpClientCore
9
10
#
include
<
userver
/
components
/
component_base
.
hpp
>
11
#
include
<
userver
/
dynamic_config
/
snapshot
.
hpp
>
12
#
include
<
userver
/
engine
/
multi_consumer_event
.
hpp
>
13
#
include
<
userver
/
utils
/
statistics
/
entry
.
hpp
>
14
15
USERVER_NAMESPACE_BEGIN
16
17
namespace
clients::
http
{
18
19
class
ClientCore;
20
21
}
// namespace clients::http
22
23
namespace
components
{
24
25
/// @ingroup userver_components
26
///
27
/// @brief Component that manages @ref clients::http::ClientCore.
28
///
29
/// Returned references to @ref clients::http::ClientCore live for a lifetime of the
30
/// component and are safe for concurrent use.
31
///
32
/// ## Dynamic options:
33
/// * @ref HTTP_CLIENT_CONNECT_THROTTLE
34
/// * @ref HTTP_CLIENT_CONNECTION_POOL_SIZE
35
///
36
/// ## Static options of components::HttpClientCore :
37
/// @include{doc} scripts/docs/en/components_schema/core/src/clients/http/component_core.md
38
///
39
/// Options inherited from @ref components::ComponentBase :
40
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
41
///
42
/// ## Static configuration example:
43
///
44
/// @snippet core/src/components/common_component_list_test.cpp Sample http client component config
45
class
HttpClientCore
final
:
public
ComponentBase
{
46
public
:
47
/// @ingroup userver_component_names
48
/// @brief The default name of components::HttpClientCore component
49
static
constexpr
std::string_view
kName
=
"http-client-core"
;
50
51
HttpClientCore(
const
ComponentConfig&,
const
ComponentContext&);
52
53
/// @cond
54
// For internal use only.
55
std::shared_ptr<clients::
http
::ClientCore> GetHttpClientCore(
utils
::impl::InternalTag);
56
57
// For internal use only.
58
void
WaitUntilConfigSet()
const
;
59
/// @endcond
60
61
static
yaml_config
::Schema GetStaticConfigSchema();
62
63
private
:
64
void
OnLoadingCancelled()
override
;
65
66
void
OnConfigUpdate(
const
dynamic_config::Diff& diff);
67
68
void
WriteStatistics(
utils
::
statistics
::Writer& writer);
69
70
const
bool
disable_pool_stats_;
71
std::shared_ptr<clients::
http
::ClientCore> http_client_;
72
73
std::atomic<
bool
> is_loading_cancelled_{
false
};
74
mutable
engine::MultiConsumerEvent config_updated_event_;
75
};
76
77
template
<>
78
inline
constexpr
bool
kHasValidate<HttpClientCore> =
true
;
79
80
template
<>
81
inline
constexpr
auto
kConfigFileMode<HttpClientCore> =
ConfigFileMode
::
kNotRequired
;
82
83
}
// namespace components
84
85
USERVER_NAMESPACE_END
userver
clients
http
component_core.hpp
Generated on
for userver by
Doxygen
1.17.0