A client for easy dynamic config fetching in components. More...
#include <userver/dynamic_config/source.hpp>
Public Types | |
using | EventSource = concurrent::AsyncEventSource< const Snapshot & > |
Public Member Functions | |
Source (impl::StorageData &storage) | |
Source (const Source &)=default | |
Source & | operator= (const Source &)=default |
Snapshot | GetSnapshot () const |
template<typename Key > | |
VariableSnapshotPtr< Key > | GetSnapshot (Key key) const |
template<typename Key > | |
VariableOfKey< Key > | GetCopy (Key key) const |
template<typename Class > | |
concurrent::AsyncEventSubscriberScope | UpdateAndListen (Class *obj, std::string_view name, void(Class::*func)(const dynamic_config::Snapshot &config)) |
EventSource & | GetEventChannel () |
A client for easy dynamic config fetching in components.
After construction, dynamic_config::Source can be copied around and passed to clients or child helper classes.
Usually retrieved from components::DynamicConfig component.
Typical usage:
Definition at line 64 of file source.hpp.
using dynamic_config::Source::EventSource = concurrent::AsyncEventSource<const Snapshot&> |
Definition at line 66 of file source.hpp.
|
explicit |
For internal use only. Obtain using components::DynamicConfig or dynamic_config::StorageMock instead.
|
inline |
Definition at line 84 of file source.hpp.
|
inline |
Definition at line 79 of file source.hpp.
|
inline |
Subscribes to dynamic-config updates using a member function, named OnConfigUpdate
by convention. Also immediately invokes the function with the current config snapshot.
Definition at line 93 of file source.hpp.