Skip to content

Commit

Permalink
Moved commit "Add created_by to Operations API" from ydb repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pixcc committed Aug 23, 2024
1 parent 2fe54ce commit 0a27948
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/ydb-cpp-sdk/client/types/operation/operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ class TOperation {
const TOperationId& Id() const;
bool Ready() const;
const TStatus& Status() const;
TInstant StartTime() const;
TInstant CreateTime() const;
TInstant EndTime() const;
const std::string& CreatedBy() const;

std::string ToString() const;
std::string ToJsonString() const;
Expand Down
21 changes: 15 additions & 6 deletions src/client/types/operation/operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TOperation::TImpl {
: Id_(operation.id(), true /* allowEmpty */)
, Status_(std::move(status))
, Ready_(operation.ready())
, StartTime_(ProtoTimestampToInstant(operation.start_time()))
, CreateTime_(ProtoTimestampToInstant(operation.create_time()))
, EndTime_(ProtoTimestampToInstant(operation.end_time()))
, Operation_(std::move(operation))
{
Expand All @@ -39,14 +39,18 @@ class TOperation::TImpl {
return Status_;
}

TInstant StartTime() const {
return StartTime_;
TInstant CreateTime() const {
return CreateTime_;
}

TInstant EndTime() const {
return EndTime_;
}

const std::string& CreatedBy() const {
return CreatedBy_;
}

const Ydb::Operations::Operation& GetProto() const {
return Operation_;
}
Expand All @@ -55,8 +59,9 @@ class TOperation::TImpl {
const TOperationId Id_;
const TStatus Status_;
const bool Ready_;
const TInstant StartTime_;
const TInstant CreateTime_;
const TInstant EndTime_;
const std::string CreatedBy_;
const Ydb::Operations::Operation Operation_;
};

Expand All @@ -80,14 +85,18 @@ const TStatus& TOperation::Status() const {
return Impl_->Status();
}

TInstant TOperation::StartTime() const {
return Impl_->StartTime();
TInstant TOperation::CreateTime() const {
return Impl_->CreateTime();
}

TInstant TOperation::EndTime() const {
return Impl_->EndTime();
}

const std::string& TOperation::CreatedBy() const {
return Impl_->CreatedBy();
}

std::string TOperation::ToString() const {
TString result;
TStringOutput out(result);
Expand Down

0 comments on commit 0a27948

Please sign in to comment.