summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/execution_service/execution_server.hpp
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2023-02-14 10:45:15 +0100
committerAlberto Sartori <alberto.sartori@huawei.com>2023-02-15 16:41:10 +0100
commitddf097f7a1c1bb438f1fc97150a263cf28be9293 (patch)
tree77a986d3c7b1143adc3bb71ce91ee72b6be41498 /src/buildtool/execution_api/execution_service/execution_server.hpp
parent1576b65e9365335aa7a2ed287eceaf93fbfac88a (diff)
downloadjustbuild-ddf097f7a1c1bb438f1fc97150a263cf28be9293.tar.gz
ExecutionServiceImpl: refactor Execute
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.hpp')
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.hpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.hpp b/src/buildtool/execution_api/execution_service/execution_server.hpp
index 02c4ed36..365858bd 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.hpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.hpp
@@ -91,7 +91,7 @@ class ExecutionServiceImpl final
auto Execute(
::grpc::ServerContext* context,
const ::build::bazel::remote::execution::v2::ExecuteRequest* request,
- ::grpc::ServerWriter< ::google::longrunning::Operation>* writer)
+ ::grpc::ServerWriter<::google::longrunning::Operation>* writer)
-> ::grpc::Status override;
// Wait for an execution operation to complete. When the client initially
@@ -105,10 +105,46 @@ class ExecutionServiceImpl final
::grpc::ServerContext* context,
const ::build::bazel::remote::execution::v2::WaitExecutionRequest*
request,
- ::grpc::ServerWriter< ::google::longrunning::Operation>* writer)
+ ::grpc::ServerWriter<::google::longrunning::Operation>* writer)
-> ::grpc::Status override;
private:
+ [[nodiscard]] auto GetAction(
+ ::build::bazel::remote::execution::v2::ExecuteRequest const* request)
+ const noexcept -> std::pair<
+ std::optional<::build::bazel::remote::execution::v2::Action>,
+ std::optional<std::string>>;
+ [[nodiscard]] auto GetCommand(
+ ::build::bazel::remote::execution::v2::Action const& action)
+ const noexcept -> std::pair<
+ std::optional<::build::bazel::remote::execution::v2::Command>,
+ std::optional<std::string>>;
+
+ [[nodiscard]] auto GetIExecutionAction(
+ ::build::bazel::remote::execution::v2::ExecuteRequest const* request,
+ ::build::bazel::remote::execution::v2::Action const& action) const
+ -> std::pair<std::optional<IExecutionAction::Ptr>,
+ std::optional<std::string>>;
+
+ [[nodiscard]] auto GetResponse(
+ ::build::bazel::remote::execution::v2::ExecuteRequest const* request,
+ IExecutionResponse::Ptr const& i_execution_response) const noexcept
+ -> std::pair<
+ std::optional<
+ ::build::bazel::remote::execution::v2::ExecuteResponse>,
+ std::optional<std::string>>;
+
+ [[nodiscard]] auto WriteResponse(
+ ::build::bazel::remote::execution::v2::ExecuteRequest const* request,
+ IExecutionResponse::Ptr const& i_execution_response,
+ ::build::bazel::remote::execution::v2::Action const& action,
+ ::grpc::ServerWriter<::google::longrunning::Operation>* writer)
+ const noexcept -> std::optional<std::string>;
+
+ [[nodiscard]] auto AddResult(
+ ::build::bazel::remote::execution::v2::ExecuteResponse* response,
+ IExecutionResponse::Ptr const& i_execution_response,
+ std::string const& hash) const noexcept -> std::optional<std::string>;
LocalStorage storage_{};
IExecutionApi::Ptr api_{new LocalApi()};
Logger logger_{"execution-service"};