summaryrefslogtreecommitdiff
path: root/src/other_tools/ops_maps/archive_fetch_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/ops_maps/archive_fetch_map.cpp')
-rw-r--r--src/other_tools/ops_maps/archive_fetch_map.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/other_tools/ops_maps/archive_fetch_map.cpp b/src/other_tools/ops_maps/archive_fetch_map.cpp
index 17b33092..91d71ce6 100644
--- a/src/other_tools/ops_maps/archive_fetch_map.cpp
+++ b/src/other_tools/ops_maps/archive_fetch_map.cpp
@@ -27,21 +27,20 @@ void ProcessContent(std::filesystem::path const& content_path,
std::filesystem::path const& target_name,
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
- std::string const& content,
+ ArtifactDigest const& content_digest,
gsl::not_null<JustMRStatistics*> const& stats,
ArchiveFetchMap::SetterPtr const& setter,
ArchiveFetchMap::LoggerPtr const& logger) {
// try to back up to remote CAS
if (remote_api != nullptr) {
if (not local_api->RetrieveToCas(
- {Artifact::ObjectInfo{
- .digest = ArtifactDigest{content, 0, /*is_tree=*/false},
- .type = ObjectType::File}},
+ {Artifact::ObjectInfo{.digest = content_digest,
+ .type = ObjectType::File}},
*remote_api)) {
// give a warning
(*logger)(fmt::format("Failed to back up content {} from local CAS "
"to remote",
- content),
+ content_digest.hash()),
/*fatal=*/false);
}
}
@@ -53,7 +52,7 @@ void ProcessContent(std::filesystem::path const& content_path,
}
if (not FileSystemManager::CopyFile(content_path, target_name)) {
(*logger)(fmt::format("Failed to copy content {} from CAS to {}",
- content,
+ content_digest.hash(),
target_name.string()),
/*fatal=*/true);
return;
@@ -96,30 +95,30 @@ auto CreateArchiveFetchMap(gsl::not_null<ContentCASMap*> const& content_cas_map,
storage,
local_api,
remote_api,
- content = key.content,
+ hash_info = key.content_hash,
stats,
setter,
logger]([[maybe_unused]] auto const& values) {
// content is in local CAS now
auto const& cas = storage->CAS();
- auto content_path =
- cas.BlobPath(ArtifactDigest{content, 0, /*is_tree=*/false},
- /*is_executable=*/false)
- .value();
+ ArtifactDigest const digest{hash_info, 0};
+ auto content_path = cas.BlobPath(digest,
+ /*is_executable=*/false)
+ .value();
ProcessContent(content_path,
target_name,
local_api,
remote_api,
- content,
+ digest,
stats,
setter,
logger);
},
- [logger, content = key.content](auto const& msg, bool fatal) {
+ [logger, hash = key.content_hash.Hash()](auto const& msg,
+ bool fatal) {
(*logger)(
- fmt::format("While ensuring content {} is in CAS:\n{}",
- content,
- msg),
+ fmt::format(
+ "While ensuring content {} is in CAS:\n{}", hash, msg),
fatal);
});
};