diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-07 15:44:23 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-07 15:44:23 +0200 |
commit | 24ff00ff5049c79fbc79ffded9b8e9da15186d2c (patch) | |
tree | eb07cba226b9f8c9758d1ad366985e77a23ad8d4 /src/buildtool/execution_api/execution_service/execution_server.cpp | |
parent | 61242ccdb8dcc0f4541172af903a493c2f3a9568 (diff) | |
download | justbuild-24ff00ff5049c79fbc79ffded9b8e9da15186d2c.tar.gz |
Pass a longrunning operation to ExecutionServer::WriteResult by rvalue
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/execution_server.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index 1576c56c..16202975 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -29,7 +29,8 @@ #include "src/utils/cpp/verify_hash.hpp" namespace { -void UpdateTimeStamp(::google::longrunning::Operation* op) { +void UpdateTimeStamp( + gsl::not_null<::google::longrunning::Operation*> const& op) { ::google::protobuf::Timestamp t; t.set_seconds( std::chrono::duration_cast<std::chrono::seconds>( @@ -135,15 +136,14 @@ auto ExecutionServiceImpl::ToBazelExecuteResponse( void ExecutionServiceImpl::WriteResponse( ::bazel_re::ExecuteResponse const& execute_response, ::grpc::ServerWriter<::google::longrunning::Operation>* writer, - ::google::longrunning::Operation* op) noexcept { - + ::google::longrunning::Operation&& op) noexcept { // send response to the client - op->mutable_response()->PackFrom(execute_response); - op->set_done(true); - UpdateTimeStamp(op); + op.mutable_response()->PackFrom(execute_response); + op.set_done(true); + UpdateTimeStamp(&op); - op_cache_.Set(op->name(), *op); - writer->Write(*op); + op_cache_.Set(op.name(), op); + writer->Write(op); } auto ExecutionServiceImpl::Execute( @@ -223,7 +223,7 @@ auto ExecutionServiceImpl::Execute( } } - WriteResponse(*execute_response, writer, &op); + WriteResponse(*execute_response, writer, std::move(op)); return ::grpc::Status::OK; } |