#include <userver/ydb/component.hpp>
YDB client component.
Provides access to ydb::TableClient, ydb::TopicClient, ydb::CoordinationClient.
Name | Description | Default value |
---|---|---|
credentials-provider | name of credentials provider component | - |
operation-settings.retries | default retries count for an operation | 3 |
operation-settings.operation-timeout | default operation timeout in utils::StringToDuration() format | 1s |
operation-settings.cancel-after | cancel operation after specified string in utils::StringToDuration() format | 1s |
operation-settings.client-timeout | default client timeout in utils::StringToDuration() format | 1s |
operation-settings.get-session-timeout | default session timeout in milliseconds | 5s |
databases.<dbname>.endpoint | gRPC endpoint URL, e.g. grpc://localhost:1234 | - |
databases.<dbname>.database | full database path, e.g. /ru/service/production/database | - |
databases.<dbname>.credentials | credentials config passed to credentials provider component | - |
databases.<dbname>.min_pool_size | minimum pool size for database with name <dbname> | 10 |
databases.<dbname>.max_pool_size | maximum pool size for database with name <dbname> | 50 |
databases.<dbname>.get_session_retry_limit | retries count to get session, every attempt with a get-session-timeout | 5 |
databases.<dbname>.keep-in-query-cache | whether to use query cache | true |
databases.<dbname>.prefer_local_dc | prefer making requests to local DataCenter | false |
databases.<dbname>.aliases | list of alias names for this database | [] |
databases.<dbname>.sync_start | fail on boot time if YDB is not accessible | true |
databases.<dbname>.by-database-timings-buckets-ms | histogram bounds for by-database timing metrics | 40 buckets with +20% increment per step |
databases.<dbname>.by-query-timings-buckets-ms | histogram bounds for by-query timing metrics | 15 buckets with +100% increment per step |
Definition at line 62 of file component.hpp.
Public Member Functions | |
YdbComponent (const components::ComponentConfig &, const components::ComponentContext &) | |
std::shared_ptr< TableClient > | GetTableClient (const std::string &dbname) const |
std::shared_ptr< TopicClient > | GetTopicClient (const std::string &dbname) const |
std::shared_ptr< CoordinationClient > | GetCoordinationClient (const std::string &dbname) const |
const NYdb::TDriver & | GetNativeDriver (const std::string &dbname) const |
const std::string & | GetDatabasePath (const std::string &dbname) const |
ComponentHealth | GetComponentHealth () const override |
void | OnLoadingCancelled () override |
void | OnAllComponentsLoaded () override |
void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Attributes | |
static constexpr std::string_view | kName = "ydb" |
The default name of ydb::YdbComponent component. | |
Protected Types | |
using | LoggableComponentBase = ComponentBase |
Legacy alias, use ComponentBase instead. | |
|
protectedinherited |
Legacy alias, use ComponentBase instead.
Definition at line 67 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Override this function to inform the world of the state of your component.
Reimplemented from components::RawComponentBase.
Reimplemented in server::handlers::Restart.
Definition at line 35 of file component_base.hpp.
std::shared_ptr< CoordinationClient > ydb::YdbComponent::GetCoordinationClient | ( | const std::string & | dbname | ) | const |
Get coordination client
dbname | database name from static config key |
const std::string & ydb::YdbComponent::GetDatabasePath | ( | const std::string & | dbname | ) | const |
Get database path
dbname | database name from static config key |
const NYdb::TDriver & ydb::YdbComponent::GetNativeDriver | ( | const std::string & | dbname | ) | const |
Get native driver
dbname | database name from static config key |
<core/include/userver/drivers/subscribable_futures.hpp>
can help with non-blocking wait operations. std::shared_ptr< TableClient > ydb::YdbComponent::GetTableClient | ( | const std::string & | dbname | ) | const |
Get table client
dbname | database name from static config key |
std::shared_ptr< TopicClient > ydb::YdbComponent::GetTopicClient | ( | const std::string & | dbname | ) | const |
Get topic client
dbname | database name from static config key |
|
inlineoverridevirtualinherited |
Component may use this function to stop doing work before the stop of the components that depend on it.
Base components may override it and make final
to do some work before the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in urabbitmq::ConsumerComponentBase, and components::Server.
Definition at line 58 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Component may use this function to finalize registration of other components that depend on it (for example, handler components register in server component, and the latter uses OnAllComponentsLoaded() to start processing requests).
Base components may override it and make final
to do some work after the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in urabbitmq::ConsumerComponentBase, components::Server, and server::handlers::Ping.
Definition at line 51 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.
Reimplemented from components::RawComponentBase.
Definition at line 42 of file component_base.hpp.