userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ydb/settings.hpp
4
/// @brief YDB operation, query and transaction settings
5
6
#
include
<
chrono
>
7
#
include
<
cstdint
>
8
#
include
<
optional
>
9
#
include
<
string
>
10
11
#
include
<
ydb
-
cpp
-
sdk
/
client
/
table
/
query_stats
/
stats
.
h
>
12
13
#
include
<
userver
/
yaml_config
/
fwd
.
hpp
>
14
15
USERVER_NAMESPACE_BEGIN
16
17
namespace
ydb {
18
19
enum
class
TransactionMode { kSerializableRW, kOnlineRO, kStaleRO, kSnapshotRO, kSnapshotRW, kImplicitTx };
20
21
/// @brief Settings for a single request.
22
struct
OperationSettings
final
{
23
/// Maximum number of retries for a single request.
24
std::optional<std::
uint32_t
>
retries
{std::nullopt};
25
26
/// Timeout for a single request.
27
std::chrono::milliseconds
client_timeout_ms
{0};
28
29
/// Transaction mode.
30
std::optional<TransactionMode>
tx_mode
{std::nullopt};
31
32
/// Timeout for getting a session.
33
std::chrono::milliseconds
get_session_timeout_ms
{0};
34
35
/// Whether a single request to YDB is idempotent.
36
bool
is_idempotent
{
false
};
37
38
/// @cond
39
// For internal use only.
40
std::string trace_id{};
41
/// @endcond
42
};
43
44
/// @brief Settings for a single query execution.
45
struct
QuerySettings
final
{
46
/// Whether to keep the query in a server-side query cache.
47
/// @deprecated Ignored. Execute uses Query API, which caches queries automatically.
48
std::optional<
bool
>
keep_in_query_cache
{std::nullopt};
49
50
/// Stats collection mode for query execution.
51
std::optional<NYdb::NTable::ECollectQueryStatsMode>
collect_query_stats
{std::nullopt};
52
};
53
54
/// @brief Settings for a single request inside a TxActor.
55
struct
RequestSettings
final
{
56
/// Timeout for a single request.
57
std::optional<std::chrono::milliseconds>
client_timeout_ms
{std::nullopt};
58
};
59
60
using
ExecuteSettings = RequestSettings;
61
using
GetSessionSettings = RequestSettings;
62
using
CommitSettings = RequestSettings;
63
using
RollbackSettings = RequestSettings;
64
65
/// @brief Settings for a transaction lambda.
66
/// @see TableClient::RetryTx.
67
struct
RetryTxSettings
final
{
68
/// Transaction mode.
69
std::optional<TransactionMode>
tx_mode
{std::nullopt};
70
71
/// Timeout for an entire transaction lambda.
72
/// @note std::nullopt means unlimited.
73
std::optional<std::chrono::milliseconds>
timeout_ms
{std::nullopt};
74
75
/// Maximum number of retries for a transaction lambda.
76
std::optional<std::
uint32_t
>
retries
{std::nullopt};
77
78
/// Whether a transaction lambda is idempotent.
79
bool
is_idempotent
{
false
};
80
81
/// Settings for a get session request.
82
GetSessionSettings
get_session_settings
{};
83
84
/// Settings for a commit transaction.
85
CommitSettings
commit_settings
{};
86
87
/// Settings for a rollback transaction.
88
RollbackSettings
rollback_settings
{};
89
};
90
91
}
// namespace ydb
92
93
namespace
formats::
parse
{
94
95
ydb::OperationSettings Parse(
const
yaml_config::
YamlConfig
& config,
To
<ydb::OperationSettings>);
96
97
}
// namespace formats::parse
98
99
USERVER_NAMESPACE_END
userver
ydb
settings.hpp
Generated on
for userver by
Doxygen
1.17.0