6#include <userver/congestion_control/limiter.hpp>
7#include <userver/congestion_control/sensor.hpp>
8#include <userver/utils/periodic_task.hpp>
9#include <userver/utils/statistics/fwd.hpp>
11USERVER_NAMESPACE_BEGIN
16 std::atomic<
bool> is_enabled{
false};
17 std::atomic<
bool> is_fake_mode{
false};
18 std::atomic<int64_t> current_limit{0};
19 std::atomic<int64_t> enabled_epochs{0};
22void DumpMetric(utils::statistics::Writer& writer,
const Stats& stats);
27 bool fake_mode{
false};
31 Controller(
const std::string& name, v2::
Sensor& sensor,
Limiter& limiter,
34 virtual ~Controller() =
default;
41 const std::string& GetName()
const;
43 void SetEnabled(
bool enabled);
49 std::optional<size_t> current_limit_;
52 std::string_view LogFakeMode()
const;
54 const std::string name_;
59 USERVER_NAMESPACE::utils::PeriodicTask periodic_;
60 std::atomic<
bool> enabled_{
true};