10#include <unordered_map>
12#include <userver/congestion_control/controllers/linear.hpp>
13#include <userver/storages/postgres/postgres_fwd.hpp>
14#include <userver/utils/impl/transparent_hash.hpp>
16USERVER_NAMESPACE_BEGIN
61 Mode mode = kReadWrite;
63 constexpr TransactionOptions() =
default;
68 constexpr explicit TransactionOptions(
Mode m) : mode{m} {}
70 bool IsReadOnly()
const {
return mode & kReadOnly; }
117 constexpr CommandControl(TimeoutDuration execute, TimeoutDuration statement)
118 : execute(execute), statement(statement) {}
120 constexpr CommandControl WithExecuteTimeout(TimeoutDuration n)
const
122 return {n, statement};
125 constexpr CommandControl WithStatementTimeout(TimeoutDuration s)
const
131 return execute == rhs.execute && statement == rhs.statement;
134 bool operator!=(
const CommandControl& rhs)
const {
return !(*
this == rhs); }
148OptionalCommandControl GetHandlerOptionalCommandControl(
149 const CommandControlByHandlerMap& map, std::string_view path,
150 std::string_view method);
152OptionalCommandControl GetQueryOptionalCommandControl(
153 const CommandControlByQueryMap& map,
const std::string& query_name);
156 std::chrono::milliseconds max_replication_lag{0};
188 return min_size == rhs.min_size && max_size == rhs.max_size &&
189 max_queue_size == rhs.max_queue_size &&
190 connecting_limit == rhs.connecting_limit;
206 enum PreparedStatementOptions {
207 kCachePreparedStatements,
208 kNoPreparedStatements,
210 enum UserTypesOptions {
212 kPredefinedTypesOnly,
214 enum CheckQueryParamsOptions {
242 return prepared_statements == rhs.prepared_statements &&
243 user_types == rhs.user_types &&
244 ignore_unused_query_params == rhs.ignore_unused_query_params &&
245 max_prepared_cache_size == rhs.max_prepared_cache_size &&
246 pipeline_mode == rhs.pipeline_mode &&
247 recent_errors_threshold == rhs.recent_errors_threshold;
251 return !(*
this == rhs);
256 return prepared_statements != rhs.prepared_statements ||
257 user_types != rhs.user_types ||
258 ignore_unused_query_params != rhs.ignore_unused_query_params ||
259 max_prepared_cache_size != rhs.max_prepared_cache_size ||
260 pipeline_mode != rhs.pipeline_mode;
267struct StatementMetricsSettings
final {
271 bool operator==(
const StatementMetricsSettings& other)
const {
272 return max_statements == other.max_statements;
282enum class ConnlimitMode {