#include <userver/dynamic_config/storage/component.hpp>
Allows to subscribe to DynamicConfig updates without waiting for the first update to complete. Primarily intended for internal use.
Definition at line 119 of file component.hpp.
Public Member Functions | |
| NoblockSubscriber (DynamicConfig &config_component) noexcept | |
| NoblockSubscriber (NoblockSubscriber &&)=delete | |
| NoblockSubscriber & | operator= (NoblockSubscriber &&)=delete |
| template<typename Class> | |
| void | UpdateIfHasConfigAndListen (utils::ResourceScopeStorage &scopes, Class *obj, std::string_view name, void(Class::*func)(const dynamic_config::Diff &diff)) |
| Subscribes to dynamic-config updates without waiting for the first update. | |
|
inline |
Subscribes to dynamic-config updates without waiting for the first update.
If a config snapshot is already loaded when the scope is entered, constructs dynamic_config::Diff from std::nullopt and the current snapshot and invokes the listener. Otherwise only subscribes; the listener is first invoked when a snapshot arrives.
Further updates are delivered after utils::ResourceScopeStorage::AfterConstruction. Unsubscribe runs in utils::ResourceScopeStorage::BeforeDestruction.
| scopes | storage that owns the subscription lifetime. In a component constructor pass context.Scopes() or components::GetResourceScopes. |
| obj | the subscriber, which is the owner of the listener method, and is also used as the unique identifier of the subscription |
| name | the name of the subscriber, for diagnostic purposes |
| func | the listener method, named OnConfigUpdate by convention. |
Definition at line 153 of file component.hpp.