userver: userver/storages/clickhouse/options.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
options.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/storages/clickhouse/options.hpp
4/// @brief Options
5
6#include <chrono>
7#include <optional>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace storages::clickhouse {
12
13/// A structure to control timeouts for ClickHouse queries
14///
15/// There is a single parameter, `execute`, which limits the overall time
16/// the driver spends executing a query, which includes:
17/// * connecting to ClickHouse server, if there are no connections available and
18/// connection pool still has space for new connections;
19/// * waiting for a connection to become idle if there are no idle connections
20/// and connection pool already has reached its max size;
21/// * executing the statement;
22/// * waiting for all the results to arrive.
23///
24/// In case of a timeout the client gets an exception and the driver drops the
25/// connection (no further reuse will take place),
26/// otherwise the connection is returned to the pool.
27struct CommandControl final {
28 /// Overall timeout for a command being executed.
29 std::chrono::milliseconds execute;
30
31 explicit constexpr CommandControl(std::chrono::milliseconds execute)
32 : execute{execute} {}
33};
34
35/// @brief storages::clickhouse::CommandControl that may not be set.
36using OptionalCommandControl = std::optional<CommandControl>;
37
38} // namespace storages::clickhouse
39
40USERVER_NAMESPACE_END