userver: /data/code/userver/odbc/include/userver/storages/odbc/command_control.hpp Source File
Loading...
Searching...
No Matches
command_control.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/storages/odbc/command_control.hpp
4/// @brief Per-operation timeout settings for the ODBC driver.
5
6#include <chrono>
7#include <optional>
8#include <string>
9
10#include <userver/utils/impl/transparent_hash.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace storages::odbc {
15
16struct CommandControl final {
17 /// Overall operation budget used for pool waiting and connection login and
18 /// as an upper bound for statement/transaction deadlines. Blocking ODBC
19 /// calls are ultimately subject to the timeout capabilities and whole-
20 /// second resolution of the selected ODBC driver.
21 std::optional<std::chrono::milliseconds> network_timeout{};
22
23 /// Timeout for statement execution. ODBC drivers accept this timeout in
24 /// whole seconds, so the value is rounded up when passed to a driver.
25 std::optional<std::chrono::milliseconds> statement_timeout{};
26
27 bool operator==(const CommandControl&) const = default;
28};
29
30using OptionalCommandControl = std::optional<CommandControl>;
31
32/// Command controls keyed by an HTTP method.
33using CommandControlByMethodMap = utils::impl::TransparentMap<std::string, CommandControl>;
34
35/// Command controls keyed first by handler path, then by HTTP method.
36using CommandControlByHandlerMap = utils::impl::TransparentMap<std::string, CommandControlByMethodMap>;
37
38/// Command controls keyed by storages::odbc::Query name.
39using CommandControlByQueryMap = utils::impl::TransparentMap<std::string, CommandControl>;
40
41} // namespace storages::odbc
42
43USERVER_NAMESPACE_END