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
5
6
#include <memory>
7
#include <string>
8
#include <unordered_map>
9
10
#include <
userver/components/component_base.hpp
>
11
#include <
userver/components/component_fwd.hpp
>
12
#include <
userver/dynamic_config/source.hpp
>
13
#include <
userver/rcu/rcu.hpp
>
14
#include <
userver/storages/redis/base.hpp
>
15
#include <
userver/storages/redis/fwd.hpp
>
16
#include <
userver/storages/redis/wait_connected_mode.hpp
>
17
#include <
userver/storages/secdist/secdist.hpp
>
18
#include <
userver/testsuite/redis_control.hpp
>
19
#include <
userver/utils/statistics/fwd.hpp
>
20
21
USERVER_NAMESPACE_BEGIN
22
24
namespace
storages
{}
25
27
namespace
storages::redis
{
28
29
class
SubscribeClientImpl;
30
31
namespace
impl {
32
class
Sentinel;
33
class
ThreadPools;
34
class
HealthCheckManager;
35
}
// namespace impl
36
}
// namespace storages::redis
37
38
namespace
components
{
39
135
class
Redis :
public
ComponentBase {
136
public
:
137
Redis(
const
ComponentConfig
& config,
const
ComponentContext
& component_context);
138
139
~Redis()
override
;
140
143
static
constexpr
std::string_view
kName
=
"redis"
;
144
146
std::shared_ptr<storages::redis::Client>
GetClient
(
147
const
std::string& name,
148
storages::redis::RedisWaitConnected
wait_connected = {}
149
)
const
;
150
151
[[deprecated(
"use GetClient()"
)]] std::shared_ptr<storages::redis::impl::Sentinel> Client(
const
std::string& name
152
)
const
;
153
155
std::shared_ptr<storages::redis::SubscribeClient>
GetSubscribeClient
(
156
const
std::string& name,
157
storages::redis::RedisWaitConnected
wait_connected = {}
158
)
const
;
159
160
ComponentHealth
GetComponentHealth
()
const override
;
161
162
static
yaml_config::Schema
GetStaticConfigSchema
();
163
164
private
:
165
void
OnConfigUpdate(
const
dynamic_config::Snapshot
& cfg);
166
void
OnSecdistUpdate(
const
storages::secdist::SecdistConfig
& cfg);
167
168
void
Connect(
169
const
ComponentConfig
& config,
170
const
ComponentContext
& component_context,
171
const
testsuite::RedisControl
& testsuite_redis_control
172
);
173
174
void
WriteStatistics(
utils::statistics::Writer
& writer);
175
void
WriteStatisticsPubsub(
utils::statistics::Writer
& writer);
176
177
std::shared_ptr<storages::redis::impl::ThreadPools> thread_pools_;
178
std::unordered_map<std::string, std::shared_ptr<storages::redis::impl::Sentinel>> sentinels_;
179
std::unordered_map<std::string, std::shared_ptr<storages::redis::Client>> clients_;
180
std::unordered_map<std::string, std::shared_ptr<storages::redis::SubscribeClientImpl>> subscribe_clients_;
181
182
std::unique_ptr<storages::redis::impl::HealthCheckManager> health_check_manager_;
183
184
dynamic_config::Source
config_;
185
186
rcu::Variable<storages::redis::MetricsSettings>
metrics_settings_;
187
rcu::Variable<storages::redis::PubsubMetricsSettings>
pubsub_metrics_settings_;
188
};
189
190
template
<>
191
inline
constexpr
bool
kHasValidate<Redis>
=
true
;
192
193
}
// namespace components
194
195
USERVER_NAMESPACE_END
userver
storages
redis
component.hpp
Generated on
for userver by
Doxygen
1.17.0