From a5f048e3b2504959994cc9545a70fde01b70d99a Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 15 Jul 2024 10:19:16 +0200 Subject: 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. --- .../execution_api/execution_service/operations_server.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/buildtool/execution_api/execution_service/operations_server.hpp') diff --git a/src/buildtool/execution_api/execution_service/operations_server.hpp b/src/buildtool/execution_api/execution_service/operations_server.hpp index 44e3b887..faa87602 100644 --- a/src/buildtool/execution_api/execution_service/operations_server.hpp +++ b/src/buildtool/execution_api/execution_service/operations_server.hpp @@ -16,11 +16,17 @@ #define OPERATIONS_SERVER_HPP #include "google/longrunning/operations.grpc.pb.h" +#include "gsl/gsl" +#include "src/buildtool/execution_api/execution_service/operation_cache.hpp" #include "src/buildtool/logging/logger.hpp" class OperarationsServiceImpl final : public ::google::longrunning::Operations::Service { public: + explicit OperarationsServiceImpl( + gsl::not_null const& op_cache) + : op_cache_{*op_cache} {}; + // Lists operations that match the specified filter in the request. If the // server doesn't support this method, it returns `UNIMPLEMENTED`. // @@ -64,6 +70,7 @@ class OperarationsServiceImpl final ::google::protobuf::Empty* response) -> ::grpc::Status override; private: + OperationCache const& op_cache_; Logger logger_{"execution-service:operations"}; }; -- cgit v1.2.3