From 8669d48933731f224474a9b1dc55824f87ae26a7 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 25 Jul 2024 14:53:18 +0200 Subject: Use LocalContext in execution and serve services The context is passed by not_null const pointer in order to avoid binding to temporaries, and it or parts of it get stored by const ref where needed. --- src/buildtool/serve_api/serve_service/target.hpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/buildtool/serve_api/serve_service/target.hpp') diff --git a/src/buildtool/serve_api/serve_service/target.hpp b/src/buildtool/serve_api/serve_service/target.hpp index aaf9bb39..88e5a205 100644 --- a/src/buildtool/serve_api/serve_service/target.hpp +++ b/src/buildtool/serve_api/serve_service/target.hpp @@ -30,12 +30,10 @@ #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" -#include "src/buildtool/execution_api/local/config.hpp" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/serve_api/remote/config.hpp" #include "src/buildtool/serve_api/remote/serve_api.hpp" -#include "src/buildtool/storage/config.hpp" -#include "src/buildtool/storage/storage.hpp" #include "src/utils/cpp/expected.hpp" // The target-level cache service. @@ -43,15 +41,11 @@ class TargetService final : public justbuild::just_serve::Target::Service { public: explicit TargetService( gsl::not_null const& serve_config, - gsl::not_null const& storage_config, - gsl::not_null const& storage, - gsl::not_null const& local_exec_config, + gsl::not_null const& local_context, gsl::not_null const& apis, ServeApi const* serve = nullptr) noexcept : serve_config_{*serve_config}, - storage_config_{*storage_config}, - storage_{*storage}, - local_exec_config_{*local_exec_config}, + local_context_{*local_context}, apis_{*apis}, serve_{serve} {} @@ -132,9 +126,7 @@ class TargetService final : public justbuild::just_serve::Target::Service { private: RemoteServeConfig const& serve_config_; - StorageConfig const& storage_config_; - Storage const& storage_; - LocalExecutionConfig const& local_exec_config_; + LocalContext const& local_context_; ApiBundle const& apis_; ServeApi const* const serve_ = nullptr; std::shared_ptr logger_{std::make_shared("target-service")}; -- cgit v1.2.3