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