userver: /data/code/userver/odbc/include/userver/storages/odbc/settings.hpp Source File
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/storages/odbc/settings.hpp
4/// @brief ODBC cluster static configuration (DSN pools)
5
6#include <cstddef>
7#include <string>
8#include <vector>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace storages::odbc::settings {
13
14/// @brief Named ODBC query metrics options.
15struct StatementMetricsSettings final {
16 /// Maximum number of named query-name entries retained by each ODBC pool.
17 /// Each entry exports three metric series. A value of 0 disables named
18 /// query metrics.
19 std::size_t max_statements{0};
20
21 bool operator==(const StatementMetricsSettings&) const = default;
22};
23
24/// @brief Per-connection prepared statement cache options.
25struct PreparedStatementCacheSettings final {
26 /// Maximum number of parameterized SQL statements retained per physical
27 /// ODBC connection. A value of 0 disables the cache.
28 std::size_t max_size{0};
29
30 bool operator==(const PreparedStatementCacheSettings&) const = default;
31};
32
33struct PoolSettings final {
34 std::size_t min_size{5};
35 std::size_t max_size{10};
36
37 bool operator==(const PoolSettings&) const = default;
38};
39
40struct HostSettings final {
41 const std::string dsn;
42 PoolSettings pool;
43
44 bool operator==(const HostSettings&) const = default;
45};
46
47struct ODBCClusterSettings final {
48 std::vector<HostSettings> pools;
49
50 bool operator==(const ODBCClusterSettings&) const = default;
51};
52
53} // namespace storages::odbc::settings
54
55USERVER_NAMESPACE_END