summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/garbage_collector.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-03-19 16:56:26 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-03-19 17:39:18 +0100
commit62ceea46f33fe6a6704b40aaa2c980c8b29eff5e (patch)
treefde64d5ff8f739b1dc7de8c48f45dadf1b869a87 /src/buildtool/storage/garbage_collector.hpp
parentc5344fadd9a032171eed799aa1d91dc9247c810f (diff)
downloadjustbuild-62ceea46f33fe6a6704b40aaa2c980c8b29eff5e.tar.gz
serve target: Fix sharding inconsistencies
When running in single node, serve endpoint should not even consider sharding. Additionally, garbage collection uplinking should also take the shard into account. For this purpose, a TargetCache instance now remembers if it was explicitly sharded and passed that information to the GarbageCollector for uplinking.
Diffstat (limited to 'src/buildtool/storage/garbage_collector.hpp')
-rw-r--r--src/buildtool/storage/garbage_collector.hpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buildtool/storage/garbage_collector.hpp b/src/buildtool/storage/garbage_collector.hpp
index c10eebc2..c4ceaf8a 100644
--- a/src/buildtool/storage/garbage_collector.hpp
+++ b/src/buildtool/storage/garbage_collector.hpp
@@ -60,9 +60,12 @@ class GarbageCollector {
/// \brief Uplink entry from target cache across all generations to latest.
/// Note that the entry will be uplinked including all referenced items.
/// \param key Target cache key to uplink entry for.
+ /// \param shard Optional explicit shard, if the default is not intended.
/// \returns true if cache entry was found and successfully uplinked.
[[nodiscard]] auto static GlobalUplinkTargetCacheEntry(
- TargetCacheKey const& key) noexcept -> bool;
+ TargetCacheKey const& key,
+ std::optional<std::string> const& shard = std::nullopt) noexcept
+ -> bool;
/// \brief Trigger garbage collection; unless no_rotation is given, this
/// will include rotation of generations and deleting the oldest generation.