Component that does a periodic update of runtime configs. More...
#include <userver/dynamic_config/updater/component.hpp>
Public Member Functions | |
DynamicConfigClientUpdater (const ComponentConfig &, const ComponentContext &) | |
dynamic_config::AdditionalKeysToken | SetAdditionalKeys (std::vector< std::string > keys) |
void | Update (cache::UpdateType update_type, const std::chrono::system_clock::time_point &last_update, const std::chrono::system_clock::time_point &now, cache::UpdateStatisticsScope &) override |
Should be overridden in a derived class to align the stored data with some data source. | |
Public Member Functions inherited from components::CachingComponentBase< dynamic_config::DocsMap > | |
CachingComponentBase (const ComponentConfig &config, const ComponentContext &) | |
utils::SharedReadablePtr< dynamic_config::DocsMap > | Get () const |
utils::SharedReadablePtr< dynamic_config::DocsMap > | GetUnsafe () const |
concurrent::AsyncEventSubscriberScope | UpdateAndListen (Class *obj, std::string name, void(Class::*func)(const std::shared_ptr< const dynamic_config::DocsMap > &)) |
concurrent::AsyncEventChannel< const std::shared_ptr< const dynamic_config::DocsMap > & > & | GetEventChannel () |
Public Member Functions inherited from components::LoggableComponentBase | |
LoggableComponentBase (const ComponentConfig &, const ComponentContext &) | |
LoggableComponentBase (LoggableComponentBase &&)=delete | |
LoggableComponentBase (const LoggableComponentBase &)=delete | |
~LoggableComponentBase () override=default | |
ComponentHealth | GetComponentHealth () const override |
void | OnLoadingCancelled () override |
void | OnAllComponentsLoaded () override |
void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Member Functions inherited from components::CachingComponentBase< dynamic_config::DocsMap > | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Member Functions inherited from components::LoggableComponentBase | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Attributes | |
static constexpr std::string_view | kName = "dynamic-config-client-updater" |
The default name of components::DynamicConfigClientUpdater. | |
Additional Inherited Members | |
Public Types inherited from components::CachingComponentBase< dynamic_config::DocsMap > | |
using | DataType = dynamic_config::DocsMap |
Protected Types inherited from cache::CacheUpdateTrait | |
enum class | Flag { kNone = 0 , kNoFirstUpdate = 1 << 0 } |
Periodic update flags. More... | |
Protected Member Functions inherited from components::CachingComponentBase< dynamic_config::DocsMap > | |
void | Set (std::unique_ptr< const dynamic_config::DocsMap > value_ptr) |
void | Set (dynamic_config::DocsMap &&value) |
void | Emplace (Args &&... args) |
void | Clear () |
virtual bool | MayReturnNull () const |
virtual void | WriteContents (dump::Writer &writer, const dynamic_config::DocsMap &contents) const |
virtual std::unique_ptr< const dynamic_config::DocsMap > | ReadContents (dump::Reader &reader) const |
Protected Member Functions inherited from cache::CacheUpdateTrait | |
AllowedUpdateTypes | GetAllowedUpdateTypes () const |
Update types configured for the cache. | |
void | StartPeriodicUpdates (utils::Flags< Flag > flags={}) |
Starts periodic updates. | |
void | StopPeriodicUpdates () |
Stops periodic updates. | |
void | AssertPeriodicUpdateStarted () |
void | OnCacheModified () |
CacheUpdateTrait (CacheUpdateTrait &&)=delete | |
CacheUpdateTrait & | operator= (CacheUpdateTrait &&)=delete |
void | InvalidateAsync (UpdateType update_type) |
Non-blocking forced cache update of specified type. | |
void | UpdateSyncDebug (UpdateType update_type) |
Forces a cache update of specified type. | |
const std::string & | Name () const |
Component that does a periodic update of runtime configs.
Config update types to deduplicate. If enabled, JSON of the whole config is compared to the previous one; if same, no config update event is sent to the subscribers of dynamic_config::Source (OnConfigUpdate
functions).
deduplicate-update-types
static config option specifies the update types of the config cache, for which event deduplication should be performed. Possible values:
none
(the default)only-full
only-incremental
full-and-incremental
Full updates will always send an event unless deduplicated. Incremental updates may send an extra event for some config service implementations.
Note: This is not a silver bullet against extra events, because the events will be sent to every dynamic config subscriber if any part of the config has updated, not if the interesting part has updated.
Name | Description | Default value |
---|---|---|
updates-sink | name of the component derived from components::DynamicConfigUpdatesSinkBase to be used for storing received updates | dynamic-config |
store-enabled | store the retrieved values into the updates sink determined by the updates-sink option | - |
load-only-my-values | request from the client only the values used by this service | - |
fallback-path | a path to the fallback config to load the required config names from it | - |
fs-task-processor | name of the task processor to run the blocking file write operations | - |
deduplicate-update-types | update types for best-effort update event deduplication, see above | full-and-incremental |
See also the options for components::CachingComponentBase.
Definition at line 73 of file component.hpp.
|
overridevirtual |
Should be overridden in a derived class to align the stored data with some data source.
Update
implementation should do one of the following:
A. If the update succeeded and has changes...
type | type of the update |
last_update | time of the last update (value of now from previous invocation of Update or default constructed value if this is the first Update). |
now | current time point |
std::exception | on update failure |
Implements cache::CacheUpdateTrait.