File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
include/ydb-cpp-sdk/client/draft Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 5
5
6
6
#include < optional>
7
7
8
+ #include < util/datetime/base.h>
9
+
8
10
namespace Ydb ::Replication {
9
11
class ConnectionParams ;
10
12
class DescribeReplicationResult ;
@@ -56,7 +58,17 @@ class TConnectionParams: private TCommonClientSettings {
56
58
> Credentials_;
57
59
};
58
60
59
- struct TRunningState {};
61
+ struct TRunningState {
62
+ public:
63
+ TRunningState () = default ;
64
+ explicit TRunningState (const std::optional<TDuration>& lag);
65
+
66
+ const std::optional<TDuration>& GetLag () const ;
67
+
68
+ private:
69
+ std::optional<TDuration> Lag_;
70
+ };
71
+
60
72
struct TDoneState {};
61
73
62
74
class TErrorState {
Original file line number Diff line number Diff line change 10
10
#include < src/client/common_client/impl/client.h>
11
11
#include < ydb-cpp-sdk/client/proto/accessor.h>
12
12
13
+ #include < google/protobuf/util/time_util.h>
13
14
#include < google/protobuf/repeated_field.h>
14
15
15
16
namespace NYdb {
@@ -58,6 +59,15 @@ const TOAuthCredentials& TConnectionParams::GetOAuthCredentials() const {
58
59
return std::get<TOAuthCredentials>(Credentials_);
59
60
}
60
61
62
+ TRunningState::TRunningState (const std::optional<TDuration>& lag)
63
+ : Lag_(lag)
64
+ {
65
+ }
66
+
67
+ const std::optional<TDuration>& TRunningState::GetLag () const {
68
+ return Lag_;
69
+ }
70
+
61
71
class TErrorState ::TImpl {
62
72
public:
63
73
NYql::TIssues Issues;
@@ -77,6 +87,10 @@ const NYql::TIssues& TErrorState::GetIssues() const {
77
87
return Impl_->Issues ;
78
88
}
79
89
90
+ TDuration DurationToDuration (const google::protobuf::Duration& value) {
91
+ return TDuration::MilliSeconds (google::protobuf::util::TimeUtil::DurationToMilliseconds (value));
92
+ }
93
+
80
94
template <typename T>
81
95
NYql::TIssues IssuesFromMessage (const ::google::protobuf::RepeatedPtrField<T>& message) {
82
96
NYql::TIssues issues;
@@ -100,7 +114,8 @@ TReplicationDescription::TReplicationDescription(const Ydb::Replication::Describ
100
114
101
115
switch (desc.state_case ()) {
102
116
case Ydb::Replication::DescribeReplicationResult::kRunning :
103
- State_ = TRunningState ();
117
+ State_ = TRunningState (desc.running ().has_lag ()
118
+ ? std::make_optional (DurationToDuration (desc.running ().lag ())) : std::nullopt);
104
119
break ;
105
120
106
121
case Ydb::Replication::DescribeReplicationResult::kError :
You can’t perform that action at this time.
0 commit comments