From 30fed59c215e786745c66481bf3ecafb40c2b3be Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 8 Oct 2024 16:57:48 +0200 Subject: serve service: Give SourceTreeService access to both local storages ...native and compatible, even if currently only native is active. While there, be more explicit in which storage instance is being used. --- src/buildtool/serve_api/serve_service/source_tree.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/buildtool/serve_api/serve_service/source_tree.hpp') diff --git a/src/buildtool/serve_api/serve_service/source_tree.hpp b/src/buildtool/serve_api/serve_service/source_tree.hpp index fb0259f9..7a63bcf9 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.hpp +++ b/src/buildtool/serve_api/serve_service/source_tree.hpp @@ -37,8 +37,6 @@ #include "src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/serve_api/remote/config.hpp" -#include "src/buildtool/storage/config.hpp" -#include "src/buildtool/storage/storage.hpp" #include "src/utils/cpp/expected.hpp" // Service for improved interaction with the target-level cache. @@ -63,12 +61,13 @@ class SourceTreeService final explicit SourceTreeService( gsl::not_null const& serve_config, - gsl::not_null const& local_context, - gsl::not_null const& apis) noexcept + gsl::not_null const& apis, + gsl::not_null const& native_context, + LocalContext const* compat_context = nullptr) noexcept : serve_config_{*serve_config}, - storage_{*local_context->storage}, - storage_config_{*local_context->storage_config}, - apis_{*apis} {} + apis_{*apis}, + native_context_{native_context}, + compat_context_{compat_context} {} // Retrieve the Git-subtree identifier from a given Git commit. // @@ -135,9 +134,9 @@ class SourceTreeService final private: RemoteServeConfig const& serve_config_; - StorageConfig const& storage_config_; - Storage const& storage_; ApiBundle const& apis_; + gsl::not_null native_context_; + LocalContext const* compat_context_; mutable std::shared_mutex mutex_; std::shared_ptr logger_{std::make_shared("serve-service")}; // symlinks resolver map -- cgit v1.2.3