61 static constexpr std::string_view
kName =
"dynamic-config";
63 class NoblockSubscriber;
65 DynamicConfig(
const ComponentConfig&,
const ComponentContext&);
66 ~DynamicConfig()
override;
76 static yaml_config::Schema GetStaticConfigSchema();
80 void OnLoadingCancelled()
override;
82 void SetConfig(std::string_view updater, dynamic_config::DocsMap&& value)
override;
84 void SetConfig(std::string_view updater,
const dynamic_config::DocsMap& value)
override;
86 void NotifyLoadingFailed(std::string_view updater, std::string_view error)
override;
89 std::unique_ptr<Impl> impl_;
94class DynamicConfig::NoblockSubscriber
final {
96 explicit NoblockSubscriber(DynamicConfig& config_component)
noexcept;
98 NoblockSubscriber(NoblockSubscriber&&) =
delete;
99 NoblockSubscriber& operator=(NoblockSubscriber&&) =
delete;
129 template <
typename Class>
132 std::string_view name,
133 void (Class::*func)(
const dynamic_config::Diff& diff)
135 return DoUpdateIfHasConfigAndListen(
138 [obj, func](
const dynamic_config::Diff& diff) { (obj->*func)(diff); }
143 concurrent::AsyncEventSubscriberScope DoUpdateIfHasConfigAndListen(
145 std::string_view name,
146 concurrent::AsyncEventSource<
const dynamic_config::Diff&>::Function&& func
149 DynamicConfig& config_component_;