diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-14 15:16:10 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-19 17:50:30 +0100 |
commit | 8ab573ef1c624e2ed81b2032178c25451176d2f1 (patch) | |
tree | b3e41ee30eed3240bcd18502b7972903e7c2a53e /src/buildtool/execution_api/common | |
parent | dfa481bd5f97d92c444dc31a4a051cb890494d1d (diff) | |
download | justbuild-8ab573ef1c624e2ed81b2032178c25451176d2f1.tar.gz |
ApiBundle: Remove HashFunction.
And ensure every user obtains HashFunction from corresponding IExecutionApi
Diffstat (limited to 'src/buildtool/execution_api/common')
-rw-r--r-- | src/buildtool/execution_api/common/TARGETS | 4 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/api_bundle.cpp | 22 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/api_bundle.hpp | 2 |
3 files changed, 13 insertions, 15 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index 3bf03655..e7624d1d 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -65,12 +65,12 @@ , ["src/buildtool/common", "config"] , ["src/buildtool/common/remote", "remote_common"] , ["src/buildtool/common/remote", "retry_config"] - , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/execution_api/local", "context"] , ["src/buildtool/execution_api/remote", "context"] ] , "private-deps": - [ ["src/buildtool/execution_api/bazel_msg", "execution_config"] + [ ["src/buildtool/crypto", "hash_function"] + , ["src/buildtool/execution_api/bazel_msg", "execution_config"] , ["src/buildtool/execution_api/local", "local_api"] , ["src/buildtool/execution_api/remote", "bazel_api"] , ["src/buildtool/execution_api/remote", "config"] diff --git a/src/buildtool/execution_api/common/api_bundle.cpp b/src/buildtool/execution_api/common/api_bundle.cpp index 69b628bc..7ab06e81 100644 --- a/src/buildtool/execution_api/common/api_bundle.cpp +++ b/src/buildtool/execution_api/common/api_bundle.cpp @@ -17,6 +17,7 @@ #include <memory> #include <utility> +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/execution_config.hpp" #include "src/buildtool/execution_api/local/local_api.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" @@ -29,23 +30,22 @@ auto ApiBundle::Create( gsl::not_null<LocalContext const*> const& local_context, gsl::not_null<RemoteContext const*> const& remote_context, RepositoryConfig const* repo_config) -> ApiBundle { - HashFunction const hash_fct = local_context->storage_config->hash_function; IExecutionApi::Ptr local_api = std::make_shared<LocalApi>(local_context, repo_config); IExecutionApi::Ptr remote_api = local_api; if (auto const address = remote_context->exec_config->remote_address) { ExecutionConfiguration config; config.skip_cache_lookup = false; - remote_api = std::make_shared<BazelApi>("remote-execution", - address->host, - address->port, - remote_context->auth, - remote_context->retry_config, - config, - hash_fct); + remote_api = std::make_shared<BazelApi>( + "remote-execution", + address->host, + address->port, + remote_context->auth, + remote_context->retry_config, + config, + local_context->storage_config->hash_function); } - return ApiBundle{.hash_function = hash_fct, - .local = std::move(local_api), + return ApiBundle{.local = std::move(local_api), .remote = std::move(remote_api)}; } @@ -63,7 +63,7 @@ auto ApiBundle::MakeRemote( authentication, retry_config, config, - hash_function); + HashFunction{local->GetHashType()}); } return local; } diff --git a/src/buildtool/execution_api/common/api_bundle.hpp b/src/buildtool/execution_api/common/api_bundle.hpp index a08e7bba..75627ac7 100644 --- a/src/buildtool/execution_api/common/api_bundle.hpp +++ b/src/buildtool/execution_api/common/api_bundle.hpp @@ -22,7 +22,6 @@ #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/common/repository_config.hpp" -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/execution_api/remote/context.hpp" @@ -51,7 +50,6 @@ struct ApiBundle final { gsl::not_null<RetryConfig const*> const& retry_config) const -> gsl::not_null<IExecutionApi::Ptr>; - HashFunction const hash_function; gsl::not_null<IExecutionApi::Ptr> const local; gsl::not_null<IExecutionApi::Ptr> const remote; }; |