summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps/content_git_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/root_maps/content_git_map.cpp')
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp350
1 files changed, 232 insertions, 118 deletions
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index 43222763..ecae60ac 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -52,7 +52,10 @@ void EnsureRootAsAbsent(
std::string const& tree_id,
ArchiveRepoInfo const& key,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
+ 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,
bool is_cache_hit,
ContentGitMap::SetterPtr const& ws_setter,
@@ -114,7 +117,11 @@ void EnsureRootAsAbsent(
if (not EnsureAbsentRootOnServe(
*serve,
tree_id,
- storage_config->GitRoot(),
+ native_storage_config->GitRoot(), /*repo_path*/
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
logger,
/*no_sync_is_fatal=*/true)) {
@@ -137,12 +144,17 @@ void EnsureRootAsAbsent(
// the tree is known locally, so we can upload it to remote
// CAS for the serve endpoint to retrieve it and set up the
// root
- if (not EnsureAbsentRootOnServe(*serve,
- tree_id,
- storage_config->GitRoot(),
- remote_api,
- logger,
- /*no_sync_is_fatal=*/true)) {
+ if (not EnsureAbsentRootOnServe(
+ *serve,
+ tree_id,
+ native_storage_config->GitRoot(), /*repo_root*/
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
+ remote_api,
+ logger,
+ /*no_sync_is_fatal=*/true)) {
return;
}
}
@@ -171,7 +183,10 @@ void ResolveContentTree(
bool is_cache_hit,
bool is_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
+ 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,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
@@ -181,7 +196,7 @@ void ResolveContentTree(
if (key.pragma_special) {
// get the resolved tree
auto tree_id_file = StorageUtils::GetResolvedTreeIDFile(
- *storage_config, tree_hash, *key.pragma_special);
+ *native_storage_config, tree_hash, *key.pragma_special);
if (FileSystemManager::Exists(tree_id_file)) {
// read resolved tree id
auto resolved_tree_id = FileSystemManager::ReadFile(tree_id_file);
@@ -197,18 +212,22 @@ void ResolveContentTree(
EnsureRootAsAbsent(*resolved_tree_id,
key,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
is_cache_hit,
ws_setter,
logger);
}
else {
- (*ws_setter)(std::pair(
- nlohmann::json::array({FileRoot::kGitTreeMarker,
- *resolved_tree_id,
- storage_config->GitRoot().string()}),
- /*is_cache_hit=*/is_cache_hit));
+ (*ws_setter)(
+ std::pair(nlohmann::json::array(
+ {FileRoot::kGitTreeMarker,
+ *resolved_tree_id,
+ native_storage_config->GitRoot().string()}),
+ /*is_cache_hit=*/is_cache_hit));
}
}
else {
@@ -229,7 +248,10 @@ void ResolveContentTree(
key,
is_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
ts,
ws_setter,
@@ -239,7 +261,8 @@ void ResolveContentTree(
GitOpKey op_key = {
.params =
{
- storage_config->GitRoot(), // target_path
+ native_storage_config
+ ->GitRoot(), // target_path
resolved_tree_id, // git_hash
"Keep referenced tree alive" // message
},
@@ -252,7 +275,10 @@ void ResolveContentTree(
tree_id_file,
is_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
is_cache_hit,
ws_setter,
@@ -279,7 +305,10 @@ void ResolveContentTree(
EnsureRootAsAbsent(resolved_tree_id,
key,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
is_cache_hit,
ws_setter,
@@ -290,11 +319,13 @@ void ResolveContentTree(
nlohmann::json::array(
{FileRoot::kGitTreeMarker,
resolved_tree_id,
- storage_config->GitRoot().string()}),
+ native_storage_config->GitRoot()
+ .string()}),
/*is_cache_hit=*/is_cache_hit));
}
},
- [logger, target_path = storage_config->GitRoot()](
+ [logger,
+ target_path = native_storage_config->GitRoot()](
auto const& msg, bool fatal) {
(*logger)(
fmt::format("While running critical Git op "
@@ -320,18 +351,22 @@ void ResolveContentTree(
EnsureRootAsAbsent(tree_hash,
key,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
is_cache_hit,
ws_setter,
logger);
}
else {
- (*ws_setter)(std::pair(
- nlohmann::json::array({FileRoot::kGitTreeMarker,
- tree_hash,
- storage_config->GitRoot().string()}),
- /*is_cache_hit=*/is_cache_hit));
+ (*ws_setter)(
+ std::pair(nlohmann::json::array(
+ {FileRoot::kGitTreeMarker,
+ tree_hash,
+ native_storage_config->GitRoot().string()}),
+ /*is_cache_hit=*/is_cache_hit));
}
}
}
@@ -346,7 +381,10 @@ void WriteIdFileAndSetWSRoot(
std::filesystem::path const& archive_tree_id_file,
bool is_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
+ 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,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
@@ -391,7 +429,10 @@ void WriteIdFileAndSetWSRoot(
false, /*is_cache_hit*/
is_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
resolve_symlinks_map,
@@ -409,7 +450,10 @@ void ExtractAndImportToGit(
std::filesystem::path const& archive_tree_id_file,
bool is_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
+ 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,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
gsl::not_null<ImportToGitMap*> const& import_to_git_map,
@@ -418,7 +462,7 @@ void ExtractAndImportToGit(
ContentGitMap::SetterPtr const& setter,
ContentGitMap::LoggerPtr const& logger) {
// extract archive
- auto tmp_dir = storage_config->CreateTypedTmpDir(key.repo_type);
+ auto tmp_dir = native_storage_config->CreateTypedTmpDir(key.repo_type);
if (not tmp_dir) {
(*logger)(fmt::format("Failed to create tmp path for {} target {}",
key.repo_type,
@@ -447,7 +491,10 @@ void ExtractAndImportToGit(
key,
is_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
resolve_symlinks_map,
@@ -469,7 +516,10 @@ void ExtractAndImportToGit(
archive_tree_id_file,
is_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
resolve_symlinks_map,
@@ -487,13 +537,13 @@ void ExtractAndImportToGit(
}
auto IdFileExistsInOlderGeneration(
- gsl::not_null<StorageConfig const*> const& storage_config,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
ArchiveRepoInfo const& key) -> std::optional<std::size_t> {
for (std::size_t generation = 1;
- generation < storage_config->num_generations;
+ generation < native_storage_config->num_generations;
generation++) {
auto archive_tree_id_file =
- StorageUtils::GetArchiveTreeIDFile(*storage_config,
+ StorageUtils::GetArchiveTreeIDFile(*native_storage_config,
key.repo_type,
key.archive.content_hash.Hash(),
generation);
@@ -509,9 +559,12 @@ void HandleLocallyKnownTree(
std::filesystem::path const& archive_tree_id_file,
bool fetch_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
+ StorageConfig const* compat_storage_config,
+ Storage const* compat_storage,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ IExecutionApi const* local_api,
IExecutionApi const* remote_api,
gsl::not_null<TaskSystem*> const& ts,
ContentGitMap::SetterPtr const& setter,
@@ -528,11 +581,11 @@ void HandleLocallyKnownTree(
// define Git operation to be done
GitOpKey op_key = {.params =
{
- storage_config->GitRoot(), // target_path
- "", // git_hash
- std::nullopt, // message
- std::nullopt, // source_path
- true // init_bare
+ native_storage_config->GitRoot(), // target_path
+ "", // git_hash
+ std::nullopt, // message
+ std::nullopt, // source_path
+ true // init_bare
},
.op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
@@ -542,7 +595,10 @@ void HandleLocallyKnownTree(
key,
fetch_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
resolve_symlinks_map,
@@ -585,7 +641,10 @@ void HandleLocallyKnownTree(
/*is_cache_hit = */ true,
/*is_absent = */ (key.absent and not fetch_absent),
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
resolve_symlinks_map,
@@ -593,8 +652,8 @@ void HandleLocallyKnownTree(
setter,
logger);
},
- [logger, target_path = storage_config->GitRoot()](auto const& msg,
- bool fatal) {
+ [logger, target_path = native_storage_config->GitRoot()](
+ auto const& msg, bool fatal) {
(*logger)(fmt::format("While running critical Git "
"op ENSURE_INIT for "
"target {}:\n{}",
@@ -609,9 +668,12 @@ void HandleKnownInOlderGenerationAfterImport(
const std::string& tree_id,
bool fetch_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
+ StorageConfig const* compat_storage_config,
+ Storage const* compat_storage,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ IExecutionApi const* local_api,
IExecutionApi const* remote_api,
gsl::not_null<TaskSystem*> const& ts,
ContentGitMap::SetterPtr const& setter,
@@ -619,7 +681,7 @@ void HandleKnownInOlderGenerationAfterImport(
// Now that we have the tree persisted in the git repository of the youngest
// generation; hence we can write the map-entry.
auto archive_tree_id_file = StorageUtils::GetArchiveTreeIDFile(
- *storage_config, key.repo_type, key.archive.content_hash.Hash());
+ *native_storage_config, key.repo_type, key.archive.content_hash.Hash());
if (not StorageUtils::WriteTreeIDFile(archive_tree_id_file, tree_id)) {
(*logger)(fmt::format("Failed to write tree id to file {}",
archive_tree_id_file.string()),
@@ -632,9 +694,12 @@ void HandleKnownInOlderGenerationAfterImport(
archive_tree_id_file,
fetch_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -649,10 +714,12 @@ void HandleKnownInOlderGenerationAfterTaggingAndInit(
std::filesystem::path const& source,
bool fetch_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
- gsl::not_null<Storage const*> const& storage,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
+ StorageConfig const* compat_storage_config,
+ Storage const* compat_storage,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ IExecutionApi const* local_api,
IExecutionApi const* remote_api,
gsl::not_null<TaskSystem*> const& ts,
ContentGitMap::SetterPtr const& setter,
@@ -672,14 +739,14 @@ void HandleKnownInOlderGenerationAfterTaggingAndInit(
fatal);
});
if (not git_repo->LocalFetchViaTmpRepo(
- *storage_config, source, tag, fetch_logger)) {
+ *native_storage_config, source, tag, fetch_logger)) {
return;
}
GitOpKey op_key = {.params =
{
- storage_config->GitRoot(), // target_path
- tree_id, // git_hash
- "Keep referenced tree alive" // message
+ native_storage_config->GitRoot(), // target_path
+ tree_id, // git_hash
+ "Keep referenced tree alive" // message
},
.op_type = GitOpType::KEEP_TREE};
critical_git_op_map->ConsumeAfterKeysReady(
@@ -690,10 +757,12 @@ void HandleKnownInOlderGenerationAfterTaggingAndInit(
git_cas,
fetch_absent,
serve,
- storage_config,
- storage,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -709,9 +778,12 @@ void HandleKnownInOlderGenerationAfterTaggingAndInit(
tree_id,
fetch_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -732,21 +804,23 @@ void HandleKnownInOlderGenerationAfterTagging(
std::filesystem::path const& source,
bool fetch_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
- gsl::not_null<Storage const*> const& storage,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
+ StorageConfig const* compat_storage_config,
+ Storage const* compat_storage,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ IExecutionApi const* local_api,
IExecutionApi const* remote_api,
gsl::not_null<TaskSystem*> const& ts,
ContentGitMap::SetterPtr const& setter,
ContentGitMap::LoggerPtr const& logger) {
GitOpKey op_key = {.params =
{
- storage_config->GitRoot(), // target_path
- "", // git_hash
- std::nullopt, // message
- std::nullopt, // source_path
- true // init_bare
+ native_storage_config->GitRoot(), // target_path
+ "", // git_hash
+ std::nullopt, // message
+ std::nullopt, // source_path
+ true // init_bare
},
.op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
@@ -758,10 +832,12 @@ void HandleKnownInOlderGenerationAfterTagging(
source,
fetch_absent,
serve,
- storage_config,
- storage,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -780,17 +856,19 @@ void HandleKnownInOlderGenerationAfterTagging(
source,
fetch_absent,
serve,
- storage_config,
- storage,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
logger);
},
- [logger, target_path = storage_config->GitRoot()](auto const& msg,
- bool fatal) {
+ [logger, target_path = native_storage_config->GitRoot()](
+ auto const& msg, bool fatal) {
(*logger)(fmt::format("While running critical Git op "
"ENSURE_INIT for target {}:\n{}",
target_path.string(),
@@ -804,16 +882,18 @@ void HandleKnownInOlderGeneration(
std::size_t generation,
bool fetch_absent,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
- gsl::not_null<Storage const*> const& storage,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
+ StorageConfig const* compat_storage_config,
+ Storage const* compat_storage,
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ IExecutionApi const* local_api,
IExecutionApi const* remote_api,
gsl::not_null<TaskSystem*> const& ts,
ContentGitMap::SetterPtr const& setter,
ContentGitMap::LoggerPtr const& logger) {
auto archive_tree_id_file =
- StorageUtils::GetArchiveTreeIDFile(*storage_config,
+ StorageUtils::GetArchiveTreeIDFile(*native_storage_config,
key.repo_type,
key.archive.content_hash.Hash(),
generation);
@@ -824,7 +904,7 @@ void HandleKnownInOlderGeneration(
/*fatal=*/true);
return;
}
- auto source = storage_config->GitGenerationRoot(generation);
+ auto source = native_storage_config->GitGenerationRoot(generation);
GitOpKey op_key = {.params =
{
@@ -841,10 +921,12 @@ void HandleKnownInOlderGeneration(
source,
fetch_absent,
serve,
- storage_config,
- storage,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -861,10 +943,12 @@ void HandleKnownInOlderGeneration(
source,
fetch_absent,
serve,
- storage_config,
- storage,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -891,8 +975,11 @@ auto CreateContentGitMap(
gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
ServeApi const* serve,
- gsl::not_null<StorageConfig const*> const& storage_config,
- gsl::not_null<Storage const*> const& storage,
+ gsl::not_null<StorageConfig const*> const& native_storage_config,
+ StorageConfig const* compat_storage_config,
+ gsl::not_null<Storage const*> const& native_storage,
+ Storage const* compat_storage,
+ IExecutionApi const* local_api,
IExecutionApi const* remote_api,
bool fetch_absent,
gsl::not_null<JustMRProgress*> const& progress,
@@ -905,8 +992,11 @@ auto CreateContentGitMap(
additional_mirrors,
ca_info,
serve,
- storage,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ native_storage,
+ compat_storage,
+ local_api,
remote_api,
fetch_absent,
progress](auto ts,
@@ -914,31 +1004,38 @@ auto CreateContentGitMap(
auto logger,
auto /* unused */,
auto const& key) {
- auto archive_tree_id_file = StorageUtils::GetArchiveTreeIDFile(
- *storage_config, key.repo_type, key.archive.content_hash.Hash());
+ auto archive_tree_id_file =
+ StorageUtils::GetArchiveTreeIDFile(*native_storage_config,
+ key.repo_type,
+ key.archive.content_hash.Hash());
if (FileSystemManager::Exists(archive_tree_id_file)) {
HandleLocallyKnownTree(key,
archive_tree_id_file,
fetch_absent,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
logger);
}
- else if (auto generation =
- IdFileExistsInOlderGeneration(storage_config, key)) {
+ else if (auto generation = IdFileExistsInOlderGeneration(
+ native_storage_config, key)) {
HandleKnownInOlderGeneration(key,
*generation,
fetch_absent,
serve,
- storage_config,
- storage,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
resolve_symlinks_map,
critical_git_op_map,
+ local_api,
remote_api,
ts,
setter,
@@ -981,16 +1078,19 @@ auto CreateContentGitMap(
// a serve endpoint exists we can upload it the root ourselves;
// check if content already in CAS
- auto const& cas = storage->CAS();
+ auto const& native_cas = native_storage->CAS();
auto const digest = ArtifactDigest{key.archive.content_hash, 0};
if (auto content_cas_path =
- cas.BlobPath(digest, /*is_executable=*/false)) {
+ native_cas.BlobPath(digest, /*is_executable=*/false)) {
ExtractAndImportToGit(key,
*content_cas_path,
archive_tree_id_file,
/*is_absent = */ true,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
import_to_git_map,
@@ -1007,11 +1107,11 @@ auto CreateContentGitMap(
GitOpKey op_key = {
.params =
{
- storage_config->GitRoot(), // target_path
- "", // git_hash
- std::nullopt, // message
- std::nullopt, // source_path
- true // init_bare
+ native_storage_config->GitRoot(), // target_path
+ "", // git_hash
+ std::nullopt, // message
+ std::nullopt, // source_path
+ true // init_bare
},
.op_type = GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
@@ -1027,8 +1127,11 @@ auto CreateContentGitMap(
additional_mirrors,
ca_info,
serve,
- storage,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ native_storage,
+ compat_storage,
+ local_api,
remote_api,
progress,
ts,
@@ -1068,11 +1171,12 @@ auto CreateContentGitMap(
// blob check failed
return;
}
- auto const& cas = storage->CAS();
+ auto const& native_cas = native_storage->CAS();
if (res.second) {
// blob found; add it to CAS
- if (not cas.StoreBlob(*res.second,
- /*is_executable=*/false)) {
+ if (not native_cas.StoreBlob(
+ *res.second,
+ /*is_executable=*/false)) {
(*logger)(fmt::format(
"Failed to store content "
"{} to local CAS",
@@ -1080,14 +1184,17 @@ auto CreateContentGitMap(
/*fatal=*/true);
return;
}
- if (auto content_cas_path = cas.BlobPath(
+ if (auto content_cas_path = native_cas.BlobPath(
digest, /*is_executable=*/false)) {
ExtractAndImportToGit(key,
*content_cas_path,
archive_tree_id_file,
/*is_absent=*/true,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
import_to_git_map,
@@ -1115,17 +1222,20 @@ auto CreateContentGitMap(
.filename()
.string());
StorageUtils::AddDistfileToCAS(
- *storage, repo_distfile, just_mr_paths);
+ *native_storage, repo_distfile, just_mr_paths);
// check if content is in CAS now
- if (auto content_cas_path =
- cas.BlobPath(digest, /*is_executable=*/false)) {
+ if (auto content_cas_path = native_cas.BlobPath(
+ digest, /*is_executable=*/false)) {
progress->TaskTracker().Stop(key.archive.origin);
ExtractAndImportToGit(key,
*content_cas_path,
archive_tree_id_file,
/*is_absent=*/true,
serve,
- storage_config,
+ native_storage_config,
+ compat_storage_config,
+ compat_storage,
+ local_api,
remote_api,
critical_git_op_map,
import_to_git_map,
@@ -1142,7 +1252,7 @@ auto CreateContentGitMap(
key.archive.content_hash.Hash()),
/*fatal=*/true);
},
- [logger, target_path = storage_config->GitRoot()](
+ [logger, target_path = native_storage_config->GitRoot()](
auto const& msg, bool fatal) {
(*logger)(fmt::format("While running critical Git op "
"ENSURE_INIT for target {}:\n{}",
@@ -1158,8 +1268,8 @@ auto CreateContentGitMap(
{key.archive},
[archive_tree_id_file,
key,
- storage,
- storage_config,
+ native_storage_config,
+ native_storage,
critical_git_op_map,
import_to_git_map,
resolve_symlinks_map,
@@ -1167,11 +1277,12 @@ auto CreateContentGitMap(
setter,
logger]([[maybe_unused]] auto const& values) {
// content is in local CAS now
- auto const& cas = storage->CAS();
+ auto const& native_cas = native_storage->CAS();
auto content_cas_path =
- cas.BlobPath(
- ArtifactDigest{key.archive.content_hash, 0},
- /*is_executable=*/false)
+ native_cas
+ .BlobPath(
+ ArtifactDigest{key.archive.content_hash, 0},
+ /*is_executable=*/false)
.value();
// root can only be present, so default all arguments
// that refer to a serve endpoint
@@ -1180,7 +1291,10 @@ auto CreateContentGitMap(
archive_tree_id_file,
/*is_absent=*/false,
/*serve=*/nullptr,
- storage_config,
+ native_storage_config,
+ /*compat_storage_config=*/nullptr,
+ /*compat_storage=*/nullptr,
+ /*local_api=*/nullptr,
/*remote_api=*/nullptr,
critical_git_op_map,
import_to_git_map,