userver: userver/congestion_control/config.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
config.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/congestion_control/config.hpp
4/// @brief Congestion Control config structures
5
6#include <cstddef>
7
8#include <userver/dynamic_config/snapshot.hpp>
9#include <userver/formats/json_fwd.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace congestion_control {
14
15struct Policy {
16 size_t min_limit{2};
17 double up_rate_percent{2};
18 double down_rate_percent{5};
19
20 size_t overload_on{10};
21 size_t overload_off{3};
22
23 size_t up_count{3};
24 size_t down_count{3};
25 size_t no_limit_count{1000};
26
27 size_t load_limit_percent{0};
28 size_t load_limit_crit_percent{0};
29
30 double start_limit_factor{0.75};
31};
32
33Policy Parse(const formats::json::Value& policy, formats::parse::To<Policy>);
34
35namespace impl {
36
37struct RpsCcConfig {
38 Policy policy;
39 bool is_enabled{};
40 int activate_factor{0};
41};
42
43extern const dynamic_config::Key<RpsCcConfig> kRpsCcConfig;
44
45} // namespace impl
46
47} // namespace congestion_control
48
49USERVER_NAMESPACE_END