8#include <userver/clients/dns/resolver_fwd.hpp>
9#include <userver/dynamic_config/source.hpp>
10#include <userver/engine/task/task_processor_fwd.hpp>
11#include <userver/engine/task/task_with_result.hpp>
12#include <userver/error_injection/settings_fwd.hpp>
13#include <userver/testsuite/postgres_control.hpp>
14#include <userver/testsuite/tasks.hpp>
16#include <userver/storages/postgres/cluster_types.hpp>
17#include <userver/storages/postgres/database.hpp>
18#include <userver/storages/postgres/detail/non_transaction.hpp>
19#include <userver/storages/postgres/notify.hpp>
20#include <userver/storages/postgres/options.hpp>
21#include <userver/storages/postgres/query.hpp>
22#include <userver/storages/postgres/query_queue.hpp>
23#include <userver/storages/postgres/statistics.hpp>
24#include <userver/storages/postgres/transaction.hpp>
62USERVER_NAMESPACE_BEGIN
73using ClusterImplPtr = std::unique_ptr<ClusterImpl>;
106 clients::dns::Resolver* resolver,
107 engine::TaskProcessor& bg_task_processor,
109 DefaultCommandControls&& default_cmd_ctls,
112 testsuite::TestsuiteTasks& testsuite_tasks,
113 dynamic_config::Source config_source,
183 template <
typename... Args>
184 ResultSet Execute(ClusterHostTypeFlags,
const Query& query,
const Args&... args);
193 template <
typename... Args>
194 ResultSet Execute(ClusterHostTypeFlags, OptionalCommandControl,
const Query& query,
const Args&... args);
211 ClusterHostTypeFlags flags,
212 OptionalCommandControl statement_cmd_ctl,
221 NotifyScope
Listen(std::string_view channel, OptionalCommandControl = {});
229 void SetHandlersCommandControl(CommandControlByHandlerMap handlers_command_control);
231 void SetQueriesCommandControl(CommandControlByQueryMap queries_command_control);
247 void SetStatementMetricsSettings(
const StatementMetricsSettings& settings);
250 detail::NonTransaction Start(ClusterHostTypeFlags, OptionalCommandControl);
252 OptionalCommandControl GetQueryCmdCtl(
const std::string& query_name)
const;
253 OptionalCommandControl GetHandlersCmdCtl(OptionalCommandControl cmd_ctl)
const;
255 detail::ClusterImplPtr pimpl_;
258template <
typename... Args>
260 return Execute(flags, OptionalCommandControl{}, query, args...);
263template <
typename... Args>
265 ClusterHostTypeFlags flags,
266 OptionalCommandControl statement_cmd_ctl,
270 if (!statement_cmd_ctl && query.GetName()) {
271 statement_cmd_ctl = GetQueryCmdCtl(query.GetName()->GetUnderlying());
273 statement_cmd_ctl = GetHandlersCmdCtl(statement_cmd_ctl);
274 auto ntrx = Start(flags, statement_cmd_ctl);
275 return ntrx.Execute(statement_cmd_ctl, query, args...);