9#include <userver/logging/fwd.hpp>
10#include <userver/utils/strong_typedef.hpp>
12#include <userver/storages/redis/command_control.hpp>
13#include <userver/storages/redis/fwd.hpp>
15USERVER_NAMESPACE_BEGIN
17namespace storages::
redis {
21enum class ConnectionSecurity { kNone, kTLS };
24 std::string host =
"localhost";
27 bool read_only =
false;
28 ConnectionSecurity connection_security = ConnectionSecurity::kNone;
31 ConnectionInfo() =
default;
36 bool read_only =
false,
37 ConnectionSecurity security = ConnectionSecurity::kNone
39 : host{std::move(host)},
41 password{std::move(password)},
43 connection_security(security) {}
49 double inprogress = 0.0;
50 double timeouts = 0.0;
53using ScanCursor = int64_t;
56 bool buffering_enabled{
false};
57 size_t commands_buffering_threshold{0};
58 std::chrono::microseconds watch_command_timer_interval{0};
61 return buffering_enabled == o.buffering_enabled &&
62 commands_buffering_threshold == o.commands_buffering_threshold &&
63 watch_command_timer_interval == o.watch_command_timer_interval;
67enum class ConnectionMode {
73 enum class Level { kCluster, kShard, kInstance };
76 bool timings_enabled{
true};
77 bool command_timings_enabled{
false};
78 bool request_sizes_enabled{
false};
79 bool reply_sizes_enabled{
false};
82 return timings_enabled == rhs.timings_enabled && command_timings_enabled == rhs.command_timings_enabled &&
83 request_sizes_enabled == rhs.request_sizes_enabled && reply_sizes_enabled == rhs.reply_sizes_enabled;
86 constexpr bool operator!=(
const DynamicSettings& rhs)
const {
return !(*
this == rhs); }
90 Level level{Level::kInstance};
92 constexpr bool operator==(
const StaticSettings& rhs)
const {
return level == rhs.level; }
94 constexpr bool operator!=(
const StaticSettings& rhs)
const {
return !(*
this == rhs); }
101 : static_settings(static_settings), dynamic_settings(dynamic_settings) {}
102 MetricsSettings() =
default;
109 return static_settings == rhs.static_settings && dynamic_settings == rhs.dynamic_settings;
112 constexpr bool operator!=(
const MetricsSettings& rhs)
const {
return !(*
this == rhs); }
114 Level GetMetricsLevel()
const {
return static_settings.level; }
115 bool IsTimingsEnabled()
const {
return dynamic_settings.timings_enabled; }
116 bool IsCommandTimingsEnabled()
const {
return dynamic_settings.command_timings_enabled; }
117 bool IsRequestSizesEnabled()
const {
return dynamic_settings.request_sizes_enabled; }
118 bool IsReplySizesEnabled()
const {
return dynamic_settings.reply_sizes_enabled; }
122 bool per_shard_stats_enabled{
true};
125 return per_shard_stats_enabled == rhs.per_shard_stats_enabled;
132 bool enable_monitoring{
false};
133 bool restrict_requests{
false};