7#include <unordered_map>
8#include <unordered_set>
11#include <userver/concurrent/variable.hpp>
13USERVER_NAMESPACE_BEGIN
23class PeriodicTaskControl
final {
25 bool RunPeriodicTask(
const std::string& name);
26 void SuspendPeriodicTasks(
const std::unordered_set<std::string>& names);
31 void RegisterPeriodicTask(
const std::string& name, utils::PeriodicTask& task);
33 void UnregisterPeriodicTask(
const std::string& name,
34 utils::PeriodicTask& task);
36 utils::PeriodicTask& FindPeriodicTask(
const std::string& name);
38 concurrent::Variable<std::unordered_map<std::string, utils::PeriodicTask&>>
45 PeriodicTaskRegistrationHolder(PeriodicTaskControl& periodic_task_control,
46 std::string name, utils::PeriodicTask& task);
47 ~PeriodicTaskRegistrationHolder();
58 PeriodicTaskControl& periodic_task_control_;
60 utils::PeriodicTask& task_;