diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-15 10:19:16 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-19 09:50:37 +0200 |
commit | a5f048e3b2504959994cc9545a70fde01b70d99a (patch) | |
tree | 42ef3e92abdba766e4c56ed8e0dbfff37de22416 /src/buildtool/execution_api/execution_service/execution_server.cpp | |
parent | 1acde5fa1f37b8e4856f96aba092a38faaac737f (diff) | |
download | justbuild-a5f048e3b2504959994cc9545a70fde01b70d99a.tar.gz |
Make OperationCache a general class, not singleton
As it is used by just execute only, instantiate it inside the
ExecutionServer, which reads and writes to the cache map, and pass
a const ref to OperationsServer, which only queries.
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/execution_server.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index 62deaeea..b77ad9d3 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -427,7 +427,7 @@ auto ExecutionServiceImpl::StoreActionResult( } return std::nullopt; } -static void WriteResponse( +void ExecutionServiceImpl::WriteResponse( ::bazel_re::ExecuteResponse const& execute_response, ::grpc::ServerWriter<::google::longrunning::Operation>* writer, ::google::longrunning::Operation* op) noexcept { @@ -437,7 +437,7 @@ static void WriteResponse( op->set_done(true); UpdateTimeStamp(op); - OperationCache::Set(op->name(), *op); + op_cache_.Set(op->name(), *op); writer->Write(*op); } @@ -469,7 +469,7 @@ auto ExecutionServiceImpl::Execute( op.set_name(op_name); op.set_done(false); UpdateTimeStamp(&op); - OperationCache::Set(op_name, op); + op_cache_.Set(op_name, op); writer->Write(op); auto t0 = std::chrono::high_resolution_clock::now(); auto i_execution_response = i_execution_action->get()->Execute(&logger_); @@ -507,7 +507,7 @@ auto ExecutionServiceImpl::WaitExecution( logger_.Emit(LogLevel::Trace, "WaitExecution: {}", hash); std::optional<::google::longrunning::Operation> op; do { - op = OperationCache::Query(hash); + op = op_cache_.Query(hash); if (!op) { auto const& str = fmt::format( "Executing action {} not found in internal cache.", hash); |