diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-04 11:43:55 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-05 13:32:39 +0200 |
commit | e8992e622278d093165b3a0d8271a14424b61775 (patch) | |
tree | a53f94b17cfaa38b6d626f896a88d2eb8fc3d5d8 /src/buildtool/storage/garbage_collector.cpp | |
parent | 18d26dea1bf9c29a073870988a190cdd7dbc8ed0 (diff) | |
download | justbuild-e8992e622278d093165b3a0d8271a14424b61775.tar.gz |
Call uplinking via Uplinker
... instead of static calls to GarbageCollector
Diffstat (limited to 'src/buildtool/storage/garbage_collector.cpp')
-rw-r--r-- | src/buildtool/storage/garbage_collector.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/buildtool/storage/garbage_collector.cpp b/src/buildtool/storage/garbage_collector.cpp index 76a225c3..45237413 100644 --- a/src/buildtool/storage/garbage_collector.cpp +++ b/src/buildtool/storage/garbage_collector.cpp @@ -16,27 +16,19 @@ #include "src/buildtool/storage/garbage_collector.hpp" -#include <cstddef> #include <filesystem> #include <memory> #include <vector> #include "nlohmann/json.hpp" #include "src/buildtool/common/artifact.hpp" -#include "src/buildtool/common/bazel_types.hpp" #include "src/buildtool/compatibility/compatibility.hpp" -#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/common/message_limits.hpp" -#include "src/buildtool/file_system/file_storage.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" -#include "src/buildtool/file_system/git_repo.hpp" -#include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/compactifier.hpp" #include "src/buildtool/storage/storage.hpp" -#include "src/buildtool/storage/target_cache_entry.hpp" -#include "src/utils/cpp/hex_string.hpp" namespace { @@ -59,87 +51,6 @@ auto RemoveDirs(const std::vector<std::filesystem::path>& directories) -> bool { } // namespace -auto GarbageCollector::GlobalUplinkBlob(bazel_re::Digest const& digest, - bool is_executable) noexcept -> bool { - // Try to find blob in all generations. - auto const& latest_cas = Storage::Generation(0).CAS(); - for (std::size_t i = 0; i < StorageConfig::Instance().NumGenerations(); - ++i) { - // Note that we uplink with _skip_sync_ as we want to prefer hard links - // from older generations over copies from the companion file/exec CAS. - if (Storage::Generation(i).CAS().LocalUplinkBlob( - latest_cas, - digest, - is_executable, - /*skip_sync=*/true, - /*splice_result=*/true)) { - return true; - } - } - return false; -} - -auto GarbageCollector::GlobalUplinkLargeBlob( - bazel_re::Digest const& digest) noexcept -> bool { - // Try to find large entry in all generations. - auto const& latest_cas = Storage::Generation(0).CAS(); - for (std::size_t i = 0; i < StorageConfig::Instance().NumGenerations(); - ++i) { - if (Storage::Generation(i) - .CAS() - .LocalUplinkLargeObject<ObjectType::File>(latest_cas, digest)) { - return true; - } - } - return false; -} - -auto GarbageCollector::GlobalUplinkTree(bazel_re::Digest const& digest) noexcept - -> bool { - // Try to find tree in all generations. - auto const& latest_cas = Storage::Generation(0).CAS(); - for (std::size_t i = 0; i < StorageConfig::Instance().NumGenerations(); - ++i) { - if (Storage::Generation(i).CAS().LocalUplinkTree( - latest_cas, digest, /*splice_result=*/true)) { - return true; - } - } - return false; -} - -auto GarbageCollector::GlobalUplinkActionCacheEntry( - bazel_re::Digest const& action_id) noexcept -> bool { - // Try to find action-cache entry in all generations. - auto const& latest_ac = Storage::Generation(0).ActionCache(); - for (std::size_t i = 0; i < StorageConfig::Instance().NumGenerations(); - ++i) { - if (Storage::Generation(i).ActionCache().LocalUplinkEntry(latest_ac, - action_id)) { - return true; - } - } - return false; -} - -auto GarbageCollector::GlobalUplinkTargetCacheEntry( - TargetCacheKey const& key, - std::optional<std::string> const& shard) noexcept -> bool { - // Try to find target-cache entry in all generations. - auto const& latest_tc = - Storage::Generation(0).TargetCache().WithShard(shard); - for (std::size_t i = 0; i < StorageConfig::Instance().NumGenerations(); - ++i) { - if (Storage::Generation(i) - .TargetCache() - .WithShard(shard) - .LocalUplinkEntry(latest_tc, key)) { - return true; - } - } - return false; -} - auto GarbageCollector::SharedLock(StorageConfig const& storage_config) noexcept -> std::optional<LockFile> { return LockFile::Acquire(LockFilePath(storage_config), /*is_shared=*/true); |