diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-03-19 16:56:26 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-03-19 17:39:18 +0100 |
commit | 62ceea46f33fe6a6704b40aaa2c980c8b29eff5e (patch) | |
tree | fde64d5ff8f739b1dc7de8c48f45dadf1b869a87 /src/buildtool/storage/garbage_collector.hpp | |
parent | c5344fadd9a032171eed799aa1d91dc9247c810f (diff) | |
download | justbuild-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.hpp | 5 |
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. |