8#include <unordered_map>
10#include <userver/components/loggable_component_base.hpp>
11#include <userver/dynamic_config/source.hpp>
12#include <userver/formats/json.hpp>
13#include <userver/utils/statistics/fwd.hpp>
14#include <userver/utils/statistics/storage.hpp>
16#include <userver/ydb/fwd.hpp>
22USERVER_NAMESPACE_BEGIN
67 YdbComponent(
const components::ComponentConfig&,
72 std::shared_ptr<TableClient> GetTableClient(
const std::string& dbname)
const;
74 std::shared_ptr<TopicClient> GetTopicClient(
const std::string& dbname)
const;
76 std::shared_ptr<CoordinationClient> GetCoordinationClient(
77 const std::string& dbname)
const;
79 const NYdb::TDriver& GetNativeDriver(
const std::string& dbname)
const;
81 const std::string& GetDatabasePath(
const std::string& dbname)
const;
89 std::shared_ptr<impl::Driver> driver;
90 std::shared_ptr<TableClient> table_client;
91 std::shared_ptr<TopicClient> topic_client;
92 std::shared_ptr<CoordinationClient> coordination_client;
95 void OnConfigUpdate(
const dynamic_config::Snapshot& cfg);
96 void WriteStatistics(utils::statistics::Writer& writer)
const;
97 const Database& FindDatabase(
const std::string& dbname)
const;
99 std::unordered_map<std::string, Database> databases_;
101 dynamic_config::Source config_;
104 concurrent::AsyncEventSubscriberScope config_subscription_;
105 utils::statistics::Entry statistic_holder_;
111inline constexpr bool components::kHasValidate<ydb::YdbComponent> =
true;