5#include <userver/congestion_control/controllers/linear_config.hpp>
6#include <userver/congestion_control/controllers/v2.hpp>
7#include <userver/congestion_control/limiter.hpp>
8#include <userver/dynamic_config/source.hpp>
9#include <userver/utils/periodic_task.hpp>
10#include <userver/utils/sliding_interval.hpp>
11#include <userver/yaml_config/yaml_config.hpp>
13USERVER_NAMESPACE_BEGIN
17class LinearController
final :
public Controller {
22 const std::string& name, v2::
Sensor& sensor,
Limiter& limiter,
23 Stats& stats,
const StaticConfig& config,
24 dynamic_config::Source config_source,
25 std::function<v2::
Config(
const dynamic_config::Snapshot&)> config_getter);
31 utils::SlidingInterval<int64_t> current_load_;
32 utils::SlidingInterval<int64_t> long_timings_;
33 utils::SlidingInterval<int64_t> short_timings_;
34 std::optional<std::size_t> current_limit_;
35 std::size_t epochs_passed_{0};
37 dynamic_config::Source config_source_;
38 std::function<v2::
Config(
const dynamic_config::Snapshot&)> config_getter_;
41LinearController::StaticConfig Parse(
43 formats::
parse::
To<LinearController::StaticConfig>);