forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
|
||
#include <ydb/public/api/protos/ydb_operation.pb.h> | ||
|
||
namespace NKikimr { | ||
namespace NGRpcService { | ||
|
||
template <typename TOperation> | ||
struct TOperationConv { | ||
using Operation = Ydb::Operations::Operation; | ||
|
||
static Operation ToOperation(const TOperation& in) { | ||
Operation operation; | ||
|
||
operation.set_ready(true); | ||
operation.set_status(in.GetStatus()); | ||
|
||
if (in.IssuesSize()) { | ||
operation.mutable_issues()->CopyFrom(in.GetIssues()); | ||
} | ||
|
||
if (in.HasStartTime()) { | ||
*operation.mutable_create_time() = in.GetStartTime(); | ||
} | ||
|
||
if (in.HasEndTime()) { | ||
*operation.mutable_end_time() = in.GetEndTime(); | ||
} | ||
|
||
if (in.HasUserSID()) { | ||
operation.set_created_by(in.GetUserSID()); | ||
} | ||
|
||
return operation; | ||
} | ||
|
||
protected: | ||
template <typename TMetadata, typename TResult, typename TSettings> | ||
static void Fill(Operation& out, const TOperation& in, const TSettings& settings) { | ||
TMetadata metadata; | ||
metadata.mutable_settings()->CopyFrom(settings); | ||
metadata.set_progress(in.GetProgress()); | ||
metadata.mutable_items_progress()->CopyFrom(in.GetItemsProgress()); | ||
out.mutable_metadata()->PackFrom(metadata); | ||
|
||
TResult result; | ||
out.mutable_result()->PackFrom(result); | ||
} | ||
|
||
}; // TOperationConv | ||
|
||
} // namespace NGRpcService | ||
} // namespace NKikimr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters