diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-01-21 15:58:54 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-01-23 16:50:37 +0100 |
commit | d2eed1607c87a878e5336c891d44dbc40ef71476 (patch) | |
tree | 5b121b6d29c39a9d6391791f1de00f16d10b746a /src/other_tools/root_maps | |
parent | 2f227907de0858dd18d7151252373002f482a6da (diff) | |
download | justbuild-d2eed1607c87a878e5336c891d44dbc40ef71476.tar.gz |
JustMr: DistdirGitMap: Use serve calls
...instead of EnsureAbsentRootOnServe.
And remove unused arguments.
Diffstat (limited to 'src/other_tools/root_maps')
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 43 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.hpp | 1 |
2 files changed, 18 insertions, 26 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index 49329908..213b4f94 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -147,7 +147,6 @@ auto CreateDistdirGitMap( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, ServeApi const* serve, gsl::not_null<StorageConfig const*> const& native_storage_config, - StorageConfig const* compat_storage_config, gsl::not_null<Storage const*> const& native_storage, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, @@ -157,7 +156,6 @@ auto CreateDistdirGitMap( critical_git_op_map, serve, native_storage_config, - compat_storage_config, native_storage, local_api, remote_api](auto ts, @@ -197,9 +195,6 @@ auto CreateDistdirGitMap( key, serve, native_storage_config, - compat_storage_config, - local_api, - remote_api, setter, logger](auto const& values) { GitOpValue op_result = *values[0]; @@ -255,31 +250,29 @@ auto CreateDistdirGitMap( /*fatal=*/true); return; } - if (remote_api == nullptr) { - (*logger)( - fmt::format( - "Missing or incompatible " - "remote-execution endpoint " - "needed to sync workspace root " - "{} with the serve endpoint.", - distdir_tree_id), - /*fatal=*/true); + + auto digest = ArtifactDigestFactory::Create( + HashFunction::Type::GitSHA1, + distdir_tree_id, + /*size_unknown=*/0, + /*is_tree=*/true); + if (not digest.has_value()) { + (*logger)(std::move(digest).error(), + /*fatal=*/true); return; } + // the tree is known locally, so we upload // it to remote CAS for the serve endpoint // to retrieve it and set up the root - if (not EnsureAbsentRootOnServe( - *serve, - distdir_tree_id, - native_storage_config - ->GitRoot(), /*repo_root*/ - native_storage_config, - compat_storage_config, - &*local_api, - remote_api, - logger, - true /*no_sync_is_fatal*/)) { + auto uploaded = serve->UploadTree( + *digest, + native_storage_config->GitRoot()); + if (not uploaded.has_value()) { + (*logger)(std::move(uploaded) + .error() + .Message(), + /*fatal=*/true); return; } } diff --git a/src/other_tools/root_maps/distdir_git_map.hpp b/src/other_tools/root_maps/distdir_git_map.hpp index 7bd82ca0..98c466c6 100644 --- a/src/other_tools/root_maps/distdir_git_map.hpp +++ b/src/other_tools/root_maps/distdir_git_map.hpp @@ -62,7 +62,6 @@ using DistdirGitMap = gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, ServeApi const* serve, gsl::not_null<StorageConfig const*> const& native_storage_config, - StorageConfig const* compat_storage_config, gsl::not_null<Storage const*> const& native_storage, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, |