userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/odbc/component.hpp
4
/// @brief @copybrief components::Odbc
5
6
#
include
<
memory
>
7
#
include
<
optional
>
8
#
include
<
string
>
9
#
include
<
string_view
>
10
11
#
include
<
userver
/
components
/
component_base
.
hpp
>
12
#
include
<
userver
/
dynamic_config
/
source
.
hpp
>
13
#
include
<
userver
/
storages
/
odbc
/
settings
.
hpp
>
14
#
include
<
userver
/
storages
/
secdist
/
fwd
.
hpp
>
15
16
USERVER_NAMESPACE_BEGIN
17
18
namespace
storages::
odbc
{
19
class
Cluster
;
20
}
21
22
namespace
components
{
23
24
/// @ingroup userver_components
25
///
26
/// @brief ODBC client component that owns a storages::odbc::Cluster.
27
///
28
/// ## Dynamic options:
29
/// * @ref USERVER_ODBC_DEFAULT_COMMAND_CONTROL
30
/// * @ref USERVER_ODBC_HANDLERS_COMMAND_CONTROL
31
/// * @ref USERVER_ODBC_QUERIES_COMMAND_CONTROL
32
/// * @ref USERVER_ODBC_CONNECTION_POOL_SETTINGS
33
/// * @ref USERVER_ODBC_STATEMENT_METRICS_SETTINGS
34
/// * @ref USERVER_ODBC_PREPARED_STATEMENT_CACHE_SETTINGS
35
///
36
/// ## Static configuration example:
37
///
38
/// @snippet odbc/functional_tests/basic_chaos/static_config.yaml ODBC component config
39
///
40
/// Exactly one of `dsn`, `pools`, and `secdist_alias` must be specified.
41
/// With `secdist_alias`, connection data is loaded from components::Secdist and
42
/// is updated without changing the Cluster object returned by GetCluster().
43
///
44
/// ## Static options of components::Odbc:
45
/// @include{doc} scripts/docs/en/components_schema/odbc/src/storages/odbc/component.md
46
///
47
/// Options inherited from @ref components::ComponentBase :
48
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
49
class
Odbc
final
:
public
ComponentBase
{
50
public
:
51
static
constexpr
std::string_view kName =
"odbc"
;
52
53
Odbc(
const
ComponentConfig& config,
const
ComponentContext& context);
54
~Odbc()
override
;
55
56
std::shared_ptr<storages::
odbc
::
Cluster
> GetCluster()
const
;
57
58
static
yaml_config::Schema GetStaticConfigSchema();
59
60
private
:
61
void
OnConfigUpdate(
const
dynamic_config::Snapshot& config);
62
void
OnSecdistUpdate(
const
storages::
secdist
::SecdistConfig& secdist);
63
64
std::string name_;
65
storages::
odbc
::settings::StatementMetricsSettings statement_metrics_settings_fallback_;
66
std::optional<std::string> secdist_alias_;
67
std::shared_ptr<storages::
odbc
::
Cluster
> cluster_;
68
69
dynamic_config::Source config_source_;
70
concurrent
::AsyncEventSubscriberScope secdist_subscription_;
71
};
72
73
template
<>
74
inline
constexpr
bool
kHasValidate<Odbc> =
true
;
75
76
}
// namespace components
77
78
USERVER_NAMESPACE_END
odbc
include
userver
storages
odbc
component.hpp
Generated on
for userver by
Doxygen
1.17.0