diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-10-21 12:51:08 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-10-25 13:00:43 +0200 |
commit | 6242ef6fff52116398913a40634a71292616c126 (patch) | |
tree | 56da133aa074278c71f9489fd637d2aa5c4d1800 /src/other_tools/root_maps/root_utils.cpp | |
parent | 0675a0daf093442860d117afb060e5456e37c7e2 (diff) | |
download | justbuild-6242ef6fff52116398913a40634a71292616c126.tar.gz |
just-mr and SourceTree: Use new Git execution api instance
In just-mr: to instantiate the new Git api instance, both storage
configs, as well as the compatible storage, need to be passed to
the maps. While there, use more explicit naming schemes for the
storage and CAS instances used.
In serve: also acquire gc locks for the local storages when needed
to instantiate the new Git api, which now has access to the CAS.
In all these instances we also pass, as needed, the local api, which
currently still operates only in native mode. This makes no
difference currently, but will ensure less changes needed when the
future compatible-aware local api will be used instead.
Diffstat (limited to 'src/other_tools/root_maps/root_utils.cpp')
-rw-r--r-- | src/other_tools/root_maps/root_utils.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/other_tools/root_maps/root_utils.cpp b/src/other_tools/root_maps/root_utils.cpp index 9dd7badf..0e61c548 100644 --- a/src/other_tools/root_maps/root_utils.cpp +++ b/src/other_tools/root_maps/root_utils.cpp @@ -20,7 +20,7 @@ #include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/crypto/hash_function.hpp" -#include "src/buildtool/execution_api/git/git_api.hpp" +#include "src/buildtool/execution_api/serve/mr_git_api.hpp" #include "src/buildtool/file_system/object_type.hpp" auto CheckServeHasAbsentRoot(ServeApi const& serve, @@ -37,12 +37,17 @@ auto CheckServeHasAbsentRoot(ServeApi const& serve, return std::nullopt; } -auto EnsureAbsentRootOnServe(ServeApi const& serve, - std::string const& tree_id, - std::filesystem::path const& repo_path, - IExecutionApi const* remote_api, - AsyncMapConsumerLoggerPtr const& logger, - bool no_sync_is_fatal) -> bool { +auto EnsureAbsentRootOnServe( + ServeApi const& serve, + std::string const& tree_id, + std::filesystem::path const& repo_path, + gsl::not_null<StorageConfig const*> const& native_storage_config, + StorageConfig const* compat_storage_config, + Storage const* compat_storage, + IExecutionApi const* local_api, + IExecutionApi const* remote_api, + AsyncMapConsumerLoggerPtr const& logger, + bool no_sync_is_fatal) -> bool { if (remote_api != nullptr) { // upload tree to remote CAS auto repo = RepositoryConfig{}; @@ -55,7 +60,11 @@ auto EnsureAbsentRootOnServe(ServeApi const& serve, auto const digest = ArtifactDigestFactory::Create( HashFunction::Type::GitSHA1, tree_id, 0, /*is_tree=*/true); - auto git_api = GitApi{&repo}; + auto git_api = MRGitApi{&repo, + native_storage_config, + compat_storage_config, + compat_storage, + local_api}; if (not digest or not git_api.RetrieveToCas( {Artifact::ObjectInfo{.digest = *digest, .type = ObjectType::Tree}}, |