userver: userver/storages/redis/redis_config.hpp Source File
Loading...
Searching...
No Matches
redis_config.hpp
1#pragma once
2
3#include <chrono>
4
5#include <userver/dynamic_config/snapshot.hpp>
6#include <userver/dynamic_config/value.hpp>
7#include <userver/formats/parse/to.hpp>
8#include <userver/storages/redis/impl/base.hpp>
9#include <userver/storages/redis/impl/wait_connected_mode.hpp>
10#include <userver/utils/retry_budget.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace redis {
15CommandControl Parse(const formats::json::Value& elem,
16 formats::parse::To<CommandControl>);
17
18CommandControl::Strategy Parse(const formats::json::Value& elem,
19 formats::parse::To<CommandControl::Strategy>);
20
21WaitConnectedMode Parse(const formats::json::Value& elem,
22 formats::parse::To<WaitConnectedMode>);
23
24RedisWaitConnected Parse(const formats::json::Value& elem,
25 formats::parse::To<RedisWaitConnected>);
26
27CommandsBufferingSettings Parse(const formats::json::Value& elem,
28 formats::parse::To<CommandsBufferingSettings>);
29
30MetricsSettings::DynamicSettings Parse(
31 const formats::json::Value& elem,
32 formats::parse::To<MetricsSettings::DynamicSettings>);
33
34ReplicationMonitoringSettings Parse(
35 const formats::json::Value& elem,
36 formats::parse::To<ReplicationMonitoringSettings>);
37
38PubsubMetricsSettings Parse(const formats::json::Value& elem,
39 formats::parse::To<PubsubMetricsSettings>);
40} // namespace redis
41
42namespace storages::redis {
43
44struct Config final {
45 static Config Parse(const dynamic_config::DocsMap& docs_map);
46
47 USERVER_NAMESPACE::redis::CommandControl default_command_control;
48 USERVER_NAMESPACE::redis::CommandControl subscriber_default_command_control;
49 std::chrono::seconds subscriptions_rebalance_min_interval{};
50 USERVER_NAMESPACE::redis::RedisWaitConnected redis_wait_connected;
51 USERVER_NAMESPACE::redis::CommandsBufferingSettings
52 commands_buffering_settings;
53 USERVER_NAMESPACE::redis::MetricsSettings::DynamicSettings metrics_settings;
54 USERVER_NAMESPACE::redis::PubsubMetricsSettings pubsub_metrics_settings;
55 dynamic_config::ValueDict<
56 USERVER_NAMESPACE::redis::ReplicationMonitoringSettings>
57 replication_monitoring_settings;
58 dynamic_config::ValueDict<USERVER_NAMESPACE::utils::RetryBudgetSettings>
59 retry_budget_settings;
60};
61
62extern const dynamic_config::Key<Config> kConfig;
63
64} // namespace storages::redis
65
66USERVER_NAMESPACE_END