diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-26 12:50:44 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-30 12:10:06 +0200 |
commit | 461ba224785cba270b37375d9dc25f06a630d723 (patch) | |
tree | 34feabfb51d458284d218213214ce343bc530ba1 /src/buildtool/serve_api/remote/serve_api.hpp | |
parent | c499f460cd68d505338d9c081863418a413d1c0f (diff) | |
download | justbuild-461ba224785cba270b37375d9dc25f06a630d723.tar.gz |
Pass LocalContext and RemoteContext to ServeApi
Also switch to using the fields from RemoteContext instances
instead of those from ApiBundle.
Diffstat (limited to 'src/buildtool/serve_api/remote/serve_api.hpp')
-rw-r--r-- | src/buildtool/serve_api/remote/serve_api.hpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/buildtool/serve_api/remote/serve_api.hpp b/src/buildtool/serve_api/remote/serve_api.hpp index 54d06eed..f3861eb7 100644 --- a/src/buildtool/serve_api/remote/serve_api.hpp +++ b/src/buildtool/serve_api/remote/serve_api.hpp @@ -30,23 +30,25 @@ class ServeApi final {}; #include "src/buildtool/common/remote/port.hpp" #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" +#include "src/buildtool/execution_api/local/context.hpp" +#include "src/buildtool/execution_api/remote/context.hpp" #include "src/buildtool/file_system/git_types.hpp" #include "src/buildtool/file_system/symlinks_map/pragma_special.hpp" #include "src/buildtool/serve_api/remote/config.hpp" #include "src/buildtool/serve_api/remote/configuration_client.hpp" #include "src/buildtool/serve_api/remote/source_tree_client.hpp" #include "src/buildtool/serve_api/remote/target_client.hpp" -#include "src/buildtool/storage/storage.hpp" #include "src/utils/cpp/expected.hpp" class ServeApi final { public: explicit ServeApi(ServerAddress const& address, - gsl::not_null<Storage const*> const& storage, + gsl::not_null<LocalContext const*> const& local_context, + gsl::not_null<RemoteContext const*> const& remote_context, gsl::not_null<ApiBundle const*> const& apis) noexcept - : stc_{address, &apis->auth}, - tc_{address, storage, apis}, - cc_{address, &apis->auth, &apis->remote_config} {} + : stc_{address, remote_context}, + tc_{address, local_context->storage, remote_context, apis}, + cc_{address, remote_context} {} ~ServeApi() noexcept = default; ServeApi(ServeApi const&) = delete; @@ -56,12 +58,15 @@ class ServeApi final { [[nodiscard]] static auto Create( RemoteServeConfig const& serve_config, - gsl::not_null<Storage const*> const& storage, + gsl::not_null<LocalContext const*> const& local_context, + gsl::not_null<RemoteContext const*> const& remote_context, gsl::not_null<ApiBundle const*> const& apis) noexcept -> std::optional<ServeApi> { if (serve_config.remote_address) { - return std::make_optional<ServeApi>( - *serve_config.remote_address, storage, apis); + return std::make_optional<ServeApi>(*serve_config.remote_address, + local_context, + remote_context, + apis); } return std::nullopt; } |