Skip to content

Commit 5463e3e

Browse files
Gazizonokigithub-actions[bot]
authored andcommitted
[C++ SDK] Fixed import to ydb-cpp-sdk repo (#20265)
1 parent 57f85d1 commit 5463e3e

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

.github/last_commit.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
73c2345cf95acef59e91b8bf03a41539b4c9194d
1+
9a3ba4fbaa4d0b2d6dcff910256db11b3c909166

include/ydb-cpp-sdk/client/value/value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class TTableClient;
272272
class TValue {
273273
friend class TValueParser;
274274
friend class TProtoAccessor;
275-
friend class ::NYdb::Dev::NTable::TTableClient;
275+
friend class NTable::TTableClient;
276276
public:
277277
TValue(const TType& type, const Ydb::Value& valueProto);
278278
TValue(const TType& type, Ydb::Value&& valueProto);

include/ydb-cpp-sdk/library/retry/retry_policy.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <util/datetime/base.h>
4+
#include <util/generic/maybe.h>
45
#include <util/generic/typetraits.h>
56
#include <util/random/random.h>
67

@@ -41,7 +42,7 @@ struct IRetryPolicy {
4142

4243
//! Calculate delay before next retry if next retry is allowed.
4344
//! Returns empty maybe if retry is not allowed anymore.
44-
[[nodiscard]] virtual std::optional<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam... args) = 0;
45+
[[nodiscard]] virtual TMaybe<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam... args) = 0;
4546
};
4647

4748
virtual ~IRetryPolicy() = default;
@@ -81,8 +82,8 @@ struct TNoRetryPolicy : IRetryPolicy<TArgs...> {
8182
using IRetryState = typename IRetryPolicy<TArgs...>::IRetryState;
8283

8384
struct TNoRetryState : IRetryState {
84-
std::optional<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam...) override {
85-
return std::nullopt;
85+
TMaybe<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam...) override {
86+
return {};
8687
}
8788
};
8889

@@ -123,10 +124,10 @@ struct TExponentialBackoffPolicy : IRetryPolicy<TArgs...> {
123124
{
124125
}
125126

126-
std::optional<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam... args) override {
127+
TMaybe<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam... args) override {
127128
const ERetryErrorClass errorClass = RetryClassFunction(args...);
128129
if (errorClass == ERetryErrorClass::NoRetry || AttemptsDone >= MaxRetries || StartTime && TInstant::Now() - StartTime >= MaxTime) {
129-
return std::nullopt;
130+
return {};
130131
}
131132

132133
if (errorClass == ERetryErrorClass::LongRetry) {
@@ -212,10 +213,10 @@ struct TFixedIntervalPolicy : IRetryPolicy<TArgs...> {
212213
{
213214
}
214215

215-
std::optional<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam... args) override {
216+
TMaybe<TDuration> GetNextRetryDelay(typename TTypeTraits<TArgs>::TFuncParam... args) override {
216217
const ERetryErrorClass errorClass = RetryClassFunction(args...);
217218
if (errorClass == ERetryErrorClass::NoRetry || AttemptsDone >= MaxRetries || StartTime && TInstant::Now() - StartTime >= MaxTime) {
218-
return std::nullopt;
219+
return {};
219220
}
220221

221222
const TDuration delay = NRetryDetails::RandomizeDelay(errorClass == ERetryErrorClass::LongRetry ? LongRetryDelay : Delay);

src/library/retry/retry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class TRetryOptionsWithRetCodePolicy : public IRetryPolicy<bool> {
1717
{
1818
}
1919

20-
std::optional<TDuration> GetNextRetryDelay(bool ret) override {
20+
TMaybe<TDuration> GetNextRetryDelay(bool ret) override {
2121
if (ret || Attempt == Opts.RetryCount) {
22-
return std::nullopt;
22+
return {};
2323
}
2424
return Opts.GetTimeToSleep(Attempt++);
2525
}

src/library/retry/retry.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ class TRetryOptionsPolicy : public IRetryPolicy<const TException&> {
104104
{
105105
}
106106

107-
std::optional<TDuration> GetNextRetryDelay(const TException&) override {
107+
TMaybe<TDuration> GetNextRetryDelay(const TException&) override {
108108
if (Attempt == Opts.RetryCount) {
109-
return std::nullopt;
109+
return {};
110110
}
111111
return Opts.GetTimeToSleep(Attempt++);
112112
}
@@ -151,7 +151,7 @@ std::optional<TResult> DoWithRetry(std::function<TResult()> func, const typename
151151
retryState = retryPolicy->CreateRetryState();
152152
}
153153

154-
if (const std::optional<TDuration> delay = retryState->GetNextRetryDelay(ex)) {
154+
if (const TMaybe<TDuration> delay = retryState->GetNextRetryDelay(ex)) {
155155
if (*delay) {
156156
if (sleepFunction) {
157157
sleepFunction(*delay);
@@ -167,7 +167,7 @@ std::optional<TResult> DoWithRetry(std::function<TResult()> func, const typename
167167
}
168168
}
169169
}
170-
return std::nullopt;
170+
return {};
171171
}
172172

173173
template <typename TResult, typename TException = yexception>
@@ -204,7 +204,7 @@ TRetCode DoWithRetryOnRetCode(std::function<TRetCode()> func, const typename IRe
204204
auto retryState = retryPolicy->CreateRetryState();
205205
while (true) {
206206
TRetCode code = func();
207-
if (const std::optional<TDuration> delay = retryState->GetNextRetryDelay(code)) {
207+
if (const TMaybe<TDuration> delay = retryState->GetNextRetryDelay(code)) {
208208
if (*delay) {
209209
if (sleepFunction) {
210210
sleepFunction(*delay);

0 commit comments

Comments
 (0)