7#include <unordered_map>
9#include <userver/cache/update_type.hpp>
10#include <userver/dynamic_config/snapshot.hpp>
11#include <userver/formats/json_fwd.hpp>
12#include <userver/yaml_config/fwd.hpp>
14USERVER_NAMESPACE_BEGIN
24 using std::logic_error::logic_error;
27enum class FirstUpdateMode {
35std::string_view ToString(FirstUpdateMode);
37enum class FirstUpdateType {
40 kIncrementalThenAsyncFull,
45std::string_view ToString(FirstUpdateType);
47struct ConfigPatch
final {
48 std::chrono::milliseconds update_interval{};
49 std::chrono::milliseconds update_jitter{};
50 std::chrono::milliseconds full_update_interval{};
51 std::chrono::milliseconds full_update_jitter{};
52 std::optional<std::chrono::milliseconds> exception_interval{};
53 bool updates_enabled{
true};
54 std::uint64_t alert_on_failing_to_update_times{0};
57ConfigPatch Parse(
const formats::
json::Value& value, formats::
parse::
To<ConfigPatch>);
63 Config MergeWith(
const ConfigPatch& patch)
const;
66 bool allow_first_update_failure{};
67 std::optional<
bool> force_periodic_update;
68 bool config_updates_enabled{};
69 bool has_pre_assign_check{};
70 std::optional<std::string> task_processor_name;
71 std::chrono::milliseconds cleanup_interval{};
72 bool is_strong_period{};
73 std::optional<std::uint64_t> failed_updates_before_expiration;
74 bool is_safe_data_lifetime{};
76 FirstUpdateMode first_update_mode{};
77 FirstUpdateType first_update_type{};
79 std::chrono::milliseconds update_interval{};
80 std::chrono::milliseconds update_jitter{};
81 std::chrono::milliseconds full_update_interval{};
82 std::chrono::milliseconds full_update_jitter{};
83 std::optional<std::chrono::milliseconds> exception_interval;
84 bool updates_enabled{};
85 std::uint64_t alert_on_failing_to_update_times{};
88extern const dynamic_config::Key<std::unordered_map<std::string, ConfigPatch>> kCacheConfigSet;