userver: components::DynamicConfigClientUpdater Class Reference
Loading...
Searching...
No Matches
components::DynamicConfigClientUpdater Class Referencefinal

#include <userver/dynamic_config/updater/component.hpp>

Detailed Description

Component that does a periodic update of runtime configs.

Note that the service with dynamic config update component and without configs cache requires successful update to start. See dynamic_config_fallback for details and explanation.

Optional update event deduplication

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.

Static options:

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 true
load-only-my-values request from the client only the values used by this service true
deduplicate-update-types update types for best-effort update event deduplication, see above full-and-incremental

See also the options for components::CachingComponentBase.

Static configuration example:

# yaml
dynamic-config-client-updater:
store-enabled: true
load-only-my-values: true
# options from components::CachingComponentBase
update-types: full-and-incremental
update-interval: 5s
update-jitter: 2s
full-update-interval: 5m
first-update-fail-ok: true
config-settings: false
additional-cleanup-interval: 5m

Definition at line 76 of file component.hpp.

+ Inheritance diagram for components::DynamicConfigClientUpdater:
+ Collaboration diagram for components::DynamicConfigClientUpdater:

Public Member Functions

 DynamicConfigClientUpdater (const ComponentConfig &, const ComponentContext &)
 
dynamic_config::AdditionalKeysToken SetAdditionalKeys (std::vector< std::string > keys)
 
- Public Member Functions inherited from components::CachingComponentBase< dynamic_config::DocsMap >
 CachingComponentBase (const ComponentConfig &config, const ComponentContext &)
 
utils::SharedReadablePtr< dynamic_config::DocsMapGet () const
 
utils::SharedReadablePtr< dynamic_config::DocsMapGetUnsafe () 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
 
- 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)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void Emplace (Args &&... args)
 
void Clear ()
 Clears the content of the cache by string a default constructed T.
 
virtual bool MayReturnNull () const
 
virtual void PreAssignCheck (const dynamic_config::DocsMap *old_value_ptr, const dynamic_config::DocsMap *new_value_ptr) const
 If the option has-pre-assign-check is set true in static config, this function is called before assigning the new value to the cache.
 
virtual void WriteContents (dump::Writer &writer, const dynamic_config::DocsMap &contents) const
 
virtual std::unique_ptr< const dynamic_config::DocsMapReadContents (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
 
CacheUpdateTraitoperator= (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
 

The documentation for this class was generated from the following file: