Github   Telegram
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
components Namespace Reference

Contains functions and types to start a userver based service/tool. More...

Classes

class  AuthCheckerSettings
 Component that loads auth configuration settings from a components::Secdist componenet if the latter was registered in components::ComponentList. More...
 
class  CachingComponentBase
 Base class for caching components. More...
 
class  ClickHouse
 ClickHouse client component. More...
 
class  ComponentConfig
 
class  ComponentContext
 Class to retrieve other components. More...
 
class  ComponentList
 A list to keep a unique list of components to start with components::Run(), utils::DaemonMain() or components::RunOnce(). More...
 
class  ComponentsLoadCancelledException
 Exception that is thrown from components::ComponentContext::FindComponent() if a component load failed. More...
 
class  DumpConfigurator
 Helper component that manages common configuration for userver dumps. More...
 
class  DynamicConfig
 Component that stores the runtime config. More...
 
class  DynamicConfigClient
 Component that starts a clients::dynamic_config::Client client. More...
 
class  DynamicConfigClientUpdater
 Component that does a periodic update of runtime configs. More...
 
class  DynamicConfigFallbacks
 Component that setup runtime configs based on fallbacks from file. More...
 
class  FsCache
 Component for storing files in memory. More...
 
class  HttpClient
 Component that manages clients::http::Client. More...
 
struct  InMemoryConfig
 
class  LoggableComponentBase
 Base class for all application components, it depends on components::Logger and components::Tracer. More...
 
class  Logging
 Logging component More...
 
class  LoggingConfigurator
 Helper component to configure logging. More...
 
class  Manager
 
class  ManagerControllerComponent
 Component that prepares the engine internals and starts all the other components. More...
 
class  Mongo
 MongoDB client component. More...
 
class  MongoCache
 Base class for all caches polling mongo collection More...
 
class  MultiMongo
 Dynamically configurable MongoDB client component. More...
 
class  PostgreCache
 Caching component for PostgreSQL. See Caching Component for PostgreSQL. More...
 
class  Postgres
 PosgreSQL client component. More...
 
class  ProcessStarter
 Component for getting the engine::subprocess::ProcessStarter. More...
 
class  RabbitMQ
 RabbitMQ (AMQP 0.9.1) client component. More...
 
class  Redis
 Redis client component. More...
 
class  Secdist
 Component that stores security related data (keys, passwords, ...). More...
 
class  Server
 Component that listens for incomming requests, manages incomming connections and passes the requests to the appropriate handler. More...
 
class  SingleThreadedTaskProcessors
 Component that starts multiple single threaded task processors. More...
 
class  StatisticsStorage
 Component that keeps a utils::statistics::Storage storage for metrics. More...
 
class  SystemStatisticsCollector
 Component for system resource usage statistics collection. More...
 
class  TcpAcceptorBase
 Component for accepting incoming TCP connections. More...
 
class  TestsuiteSupport
 Testsuite support component. More...
 
class  Tracer
 Component that initializes the request tracing facilities. More...
 

Typedefs

using ComponentConfigMap = std::unordered_map< std::string, const ComponentConfig & >
 

Enumerations

enum class  ComponentHealth {
  kOk ,
  kFallback ,
  kFatal
}
 State of the component. More...
 
enum class  ConfigFileMode {
  kRequired ,
  kNotRequired
}
 
enum class  ValidationMode {
  kOnlyTurnedOn ,
  kAll
}
 

Functions

ComponentList CommonComponentList ()
 Returns the most common list of components with runtime config updates and HTTP client. More...
 
ComponentList CommonServerComponentList ()
 Returns the most common list of components to start a fully functional server. More...
 
ComponentConfig Parse (const yaml_config::YamlConfig &value, formats::parse::To< ComponentConfig >)
 
std::string GetCurrentComponentName (const ComponentConfig &config)
 Equivalent to config.Name() but works with forward declaration of the components::ComponentConfig.
 
ComponentList MinimalComponentList ()
 Returns a list of components to do basic logging, component initialization and configuration. More...
 
ComponentList MinimalServerComponentList ()
 Returns a list of components to start a basic HTTP server. More...
 
void Run (const std::string &config_path, const std::optional< std::string > &config_vars_path, const std::optional< std::string > &config_vars_override_path, const ComponentList &component_list, const std::string &init_log_path={}, logging::Format format=logging::Format::kTskv)
 
void Run (const InMemoryConfig &config, const ComponentList &component_list, const std::string &init_log_path={}, logging::Format format=logging::Format::kTskv)
 
void RunOnce (const std::string &config_path, const std::optional< std::string > &config_vars_path, const std::optional< std::string > &config_vars_override_path, const ComponentList &component_list, const std::string &init_log_path={}, logging::Format format=logging::Format::kTskv)
 
void RunOnce (const InMemoryConfig &config, const ComponentList &component_list, const std::string &init_log_path={}, logging::Format format=logging::Format::kTskv)
 
ValidationMode Parse (const yaml_config::YamlConfig &value, formats::parse::To< ValidationMode >)
 

Variables

template<>
constexpr bool kHasValidate< HttpClient > = true
 
template<>
constexpr bool kHasValidate< DumpConfigurator > = true
 
template<>
constexpr bool kHasValidate< FsCache > = true
 
template<typename Component >
constexpr bool kHasValidate = false
 
template<typename Component >
constexpr auto kConfigFileMode = ConfigFileMode::kRequired
 
template<>
constexpr bool kHasValidate< LoggingConfigurator > = true
 }@ More...
 
template<>
constexpr auto kConfigFileMode< ManagerControllerComponent >
 
template<>
constexpr bool kHasValidate< ProcessStarter > = true
 
template<>
constexpr bool kHasValidate< SingleThreadedTaskProcessors > = true
 
template<>
constexpr bool kHasValidate< StatisticsStorage > = true
 
template<>
constexpr auto kConfigFileMode< StatisticsStorage >
 
template<>
constexpr bool kHasValidate< Tracer > = true
 
template<>
constexpr bool kHasValidate< DynamicConfigClient > = true
 
template<>
constexpr bool kHasValidate< DynamicConfigFallbacks > = true
 
template<>
constexpr bool kHasValidate< DynamicConfig > = true
 
template<>
constexpr bool kHasValidate< DynamicConfigClientUpdater > = true
 
template<>
constexpr bool kHasValidate< Logging > = true
 
template<>
constexpr bool kHasValidate< Server > = true
 
template<>
constexpr bool kHasValidate< AuthCheckerSettings > = true
 
template<>
constexpr auto kConfigFileMode< AuthCheckerSettings >
 
template<>
constexpr bool kHasValidate< Secdist > = true
 
template<>
constexpr bool kHasValidate< TestsuiteSupport > = true
 
template<>
constexpr bool kHasValidate< SystemStatisticsCollector > = true
 
const std::string kFetchAndParseStage = "fetch_and_parse"
 
constexpr std::chrono::milliseconds kCpuRelaxThreshold {10}
 
constexpr std::chrono::milliseconds kCpuRelaxInterval {2}
 
template<class MongoCacheTraits >
constexpr bool kHasValidate< MongoCache< MongoCacheTraits > > = true
 
template<>
constexpr bool kHasValidate< Mongo > = true
 
template<>
constexpr bool kHasValidate< MultiMongo > = true
 
template<typename PostgreCachePolicy >
constexpr bool kHasValidate< PostgreCache< PostgreCachePolicy > > = true
 
template<>
constexpr bool kHasValidate< Postgres > = true
 
template<>
constexpr bool kHasValidate< Redis > = true
 
template<>
constexpr bool kHasValidate< ClickHouse > = true
 
template<>
constexpr bool kHasValidate< RabbitMQ > = true
 

Detailed Description

Contains functions and types to start a userver based service/tool.

Typedef Documentation

◆ ComponentConfigMap

typedef std::unordered_map< std::string, const ComponentConfig & > components::ComponentConfigMap

Definition at line 30 of file component_config.hpp.

Enumeration Type Documentation

◆ ComponentHealth

enum class components::ComponentHealth
strong

State of the component.

Enumerator
kOk 

component is alive and fine

kFallback 

component in fallback state, but the service keeps working

kFatal 

component is sick, service can not work without it

Definition at line 14 of file component_base.hpp.

◆ ConfigFileMode

enum class components::ConfigFileMode
strong

Whether the static config for the component must always be present, or can be missing

Enumerator
kRequired 

component must be setup in config

kNotRequired 

component must be not setup in config

Definition at line 25 of file component_base.hpp.

◆ ValidationMode

enum class components::ValidationMode
strong

Definition at line 12 of file static_config_validator.hpp.

Function Documentation

◆ Run() [1/2]

void components::Run ( const InMemoryConfig config,
const ComponentList component_list,
const std::string &  init_log_path = {},
logging::Format  format = logging::Format::kTskv 
)

Starts a server with the provided component list and config. Ropens the logging files on SIGUSR1.

See also
utils::DaemonMain

◆ Run() [2/2]

void components::Run ( const std::string &  config_path,
const std::optional< std::string > &  config_vars_path,
const std::optional< std::string > &  config_vars_override_path,
const ComponentList component_list,
const std::string &  init_log_path = {},
logging::Format  format = logging::Format::kTskv 
)

Starts a server with the provided component list and config loaded from file. Ropens the logging files on SIGUSR1.

See also
utils::DaemonMain

◆ RunOnce() [1/2]

void components::RunOnce ( const InMemoryConfig config,
const ComponentList component_list,
const std::string &  init_log_path = {},
logging::Format  format = logging::Format::kTskv 
)

Runs the component list once with the config.

See also
utils::DaemonMain

◆ RunOnce() [2/2]

void components::RunOnce ( const std::string &  config_path,
const std::optional< std::string > &  config_vars_path,
const std::optional< std::string > &  config_vars_override_path,
const ComponentList component_list,
const std::string &  init_log_path = {},
logging::Format  format = logging::Format::kTskv 
)

Runs the component list once with the config loaded from file.

See also
utils::DaemonMain

Variable Documentation

◆ kConfigFileMode

template<typename Component >
constexpr auto components::kConfigFileMode = ConfigFileMode::kRequired
inlineconstexpr

Specialize this to customize the loading of component settings

See also
Setup config file mode

Definition at line 71 of file component_base.hpp.

◆ kConfigFileMode< AuthCheckerSettings >

template<>
constexpr auto components::kConfigFileMode< AuthCheckerSettings >
inlineconstexpr
Initial value:
=
ConfigFileMode::kNotRequired

Definition at line 47 of file auth_checker_settings_component.hpp.

◆ kConfigFileMode< ManagerControllerComponent >

template<>
constexpr auto components::kConfigFileMode< ManagerControllerComponent >
inlineconstexpr
Initial value:
=
ConfigFileMode::kNotRequired

Definition at line 82 of file manager_controller_component.hpp.

◆ kConfigFileMode< StatisticsStorage >

template<>
constexpr auto components::kConfigFileMode< StatisticsStorage >
inlineconstexpr
Initial value:
=
ConfigFileMode::kNotRequired

Definition at line 62 of file statistics_storage.hpp.

◆ kCpuRelaxInterval

constexpr std::chrono::milliseconds components::kCpuRelaxInterval {2}
inlineconstexpr

Definition at line 31 of file base_mongo_cache.hpp.

◆ kCpuRelaxThreshold

constexpr std::chrono::milliseconds components::kCpuRelaxThreshold {10}
inlineconstexpr

Definition at line 30 of file base_mongo_cache.hpp.

◆ kFetchAndParseStage

const std::string components::kFetchAndParseStage = "fetch_and_parse"
inline

Definition at line 28 of file base_mongo_cache.hpp.

◆ kHasValidate

template<typename Component >
constexpr bool components::kHasValidate = false
inlineconstexpr

Specialize it for typename Component to validate static config against schema from Component::GetStaticConfigSchema

See also
Static configs validation

Definition at line 65 of file component_base.hpp.

◆ kHasValidate< AuthCheckerSettings >

template<>
constexpr bool components::kHasValidate< AuthCheckerSettings > = true
inlineconstexpr

Definition at line 44 of file auth_checker_settings_component.hpp.

◆ kHasValidate< ClickHouse >

template<>
constexpr bool components::kHasValidate< ClickHouse > = true
inlineconstexpr

Definition at line 77 of file component.hpp.

◆ kHasValidate< DumpConfigurator >

template<>
constexpr bool components::kHasValidate< DumpConfigurator > = true
inlineconstexpr

Definition at line 46 of file dump_configurator.hpp.

◆ kHasValidate< DynamicConfig >

template<>
constexpr bool components::kHasValidate< DynamicConfig > = true
inlineconstexpr

Definition at line 120 of file component.hpp.

◆ kHasValidate< DynamicConfigClient >

template<>
constexpr bool components::kHasValidate< DynamicConfigClient > = true
inlineconstexpr

Definition at line 57 of file component.hpp.

◆ kHasValidate< DynamicConfigClientUpdater >

template<>
constexpr bool components::kHasValidate< DynamicConfigClientUpdater > = true
inlineconstexpr

Definition at line 127 of file component.hpp.

◆ kHasValidate< DynamicConfigFallbacks >

template<>
constexpr bool components::kHasValidate< DynamicConfigFallbacks > = true
inlineconstexpr

Definition at line 49 of file component.hpp.

◆ kHasValidate< FsCache >

template<>
constexpr bool components::kHasValidate< FsCache > = true
inlineconstexpr

Definition at line 46 of file fs_cache.hpp.

◆ kHasValidate< HttpClient >

template<>
constexpr bool components::kHasValidate< HttpClient > = true
inlineconstexpr

Definition at line 80 of file component.hpp.

◆ kHasValidate< Logging >

template<>
constexpr bool components::kHasValidate< Logging > = true
inlineconstexpr

Definition at line 104 of file component.hpp.

◆ kHasValidate< LoggingConfigurator >

template<>
constexpr bool components::kHasValidate< LoggingConfigurator > = true
inlineconstexpr

}@

Definition at line 55 of file logging_configurator.hpp.

◆ kHasValidate< Mongo >

template<>
constexpr bool components::kHasValidate< Mongo > = true
inlineconstexpr

Definition at line 99 of file component.hpp.

◆ kHasValidate< MongoCache< MongoCacheTraits > >

template<class MongoCacheTraits >
constexpr bool components::kHasValidate< MongoCache< MongoCacheTraits > > = true
inlineconstexpr

Definition at line 158 of file base_mongo_cache.hpp.

◆ kHasValidate< MultiMongo >

template<>
constexpr bool components::kHasValidate< MultiMongo > = true
inlineconstexpr

Definition at line 201 of file component.hpp.

◆ kHasValidate< PostgreCache< PostgreCachePolicy > >

template<typename PostgreCachePolicy >
constexpr bool components::kHasValidate< PostgreCache< PostgreCachePolicy > > = true
inlineconstexpr

Definition at line 426 of file base_postgres_cache.hpp.

◆ kHasValidate< Postgres >

template<>
constexpr bool components::kHasValidate< Postgres > = true
inlineconstexpr

Definition at line 182 of file component.hpp.

◆ kHasValidate< ProcessStarter >

template<>
constexpr bool components::kHasValidate< ProcessStarter > = true
inlineconstexpr

Definition at line 38 of file process_starter.hpp.

◆ kHasValidate< RabbitMQ >

template<>
constexpr bool components::kHasValidate< RabbitMQ > = true
inlineconstexpr

Definition at line 77 of file component.hpp.

◆ kHasValidate< Redis >

template<>
constexpr bool components::kHasValidate< Redis > = true
inlineconstexpr

Definition at line 127 of file component.hpp.

◆ kHasValidate< Secdist >

template<>
constexpr bool components::kHasValidate< Secdist > = true
inlineconstexpr

Definition at line 53 of file component.hpp.

◆ kHasValidate< Server >

template<>
constexpr bool components::kHasValidate< Server > = true
inlineconstexpr

Definition at line 107 of file component.hpp.

◆ kHasValidate< SingleThreadedTaskProcessors >

template<>
constexpr bool components::kHasValidate< SingleThreadedTaskProcessors > = true
inlineconstexpr

Definition at line 50 of file single_threaded_task_processors.hpp.

◆ kHasValidate< StatisticsStorage >

template<>
constexpr bool components::kHasValidate< StatisticsStorage > = true
inlineconstexpr

Definition at line 59 of file statistics_storage.hpp.

◆ kHasValidate< SystemStatisticsCollector >

template<>
constexpr bool components::kHasValidate< SystemStatisticsCollector > = true
inlineconstexpr

Definition at line 66 of file system_statistics_collector.hpp.

◆ kHasValidate< TestsuiteSupport >

template<>
constexpr bool components::kHasValidate< TestsuiteSupport > = true
inlineconstexpr

Definition at line 86 of file testsuite_support.hpp.

◆ kHasValidate< Tracer >

template<>
constexpr bool components::kHasValidate< Tracer > = true
inlineconstexpr

Definition at line 45 of file tracer.hpp.