summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/common/api_bundle.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-29 11:13:08 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-30 12:10:06 +0200
commitb393090c220da61dd1c197adfac42dc47ad74f8a (patch)
tree72fb8ea9e5a9a4f9c01017c0601720b98909e3a8 /src/buildtool/execution_api/common/api_bundle.hpp
parent6089297787902f9a38a678e2ffdf639e779a1594 (diff)
downloadjustbuild-b393090c220da61dd1c197adfac42dc47ad74f8a.tar.gz
ApiBundle: Use a creator method instead of constructor
This will allow for ApiBundle to be used together with the TestApi implementation of IExecutionApi in tests. Also rename CreateRemote method to MakeRemote in order to remove any semantical confusion.
Diffstat (limited to 'src/buildtool/execution_api/common/api_bundle.hpp')
-rw-r--r--src/buildtool/execution_api/common/api_bundle.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/common/api_bundle.hpp b/src/buildtool/execution_api/common/api_bundle.hpp
index 17c64d1e..28595010 100644
--- a/src/buildtool/execution_api/common/api_bundle.hpp
+++ b/src/buildtool/execution_api/common/api_bundle.hpp
@@ -29,10 +29,13 @@
/// same time. If the remote api cannot be instantiated, it falls back to
/// exactly the same instance that local api is (&*remote == & *local).
struct ApiBundle final {
- explicit ApiBundle(
+ /// \brief Create an ApiBundle instance.
+ /// \note A creator method is used instead of a constructor to allow for
+ /// tests to instantiate ApiBundles with own implementations of the APIs.
+ [[nodiscard]] static auto Create(
gsl::not_null<LocalContext const*> const& local_context,
gsl::not_null<RemoteContext const*> const& remote_context,
- RepositoryConfig const* repo_config);
+ RepositoryConfig const* repo_config) -> ApiBundle;
/// \brief Create a Remote object based on the given arguments.
/// \param address The endpoint address.
@@ -40,13 +43,12 @@ struct ApiBundle final {
/// \param retry_config The retry strategy configuration.
/// \returns A configured api: BazelApi if a remote address is given,
/// otherwise fall back to the already configured LocalApi instance.
- [[nodiscard]] auto CreateRemote(
+ [[nodiscard]] auto MakeRemote(
std::optional<ServerAddress> const& address,
gsl::not_null<Auth const*> const& authentication,
gsl::not_null<RetryConfig const*> const& retry_config) const
-> gsl::not_null<IExecutionApi::Ptr>;
- // Needed to be set before creating the remote (via CreateRemote)
HashFunction const hash_function;
// 7 bytes of alignment.