59class CacheControl
final {
67 const std::unordered_set<std::string>& force_incremental_names,
68 const std::unordered_set<std::string>& exclude_names
77 std::unordered_set<std::string> reset_only_names,
78 const std::unordered_set<std::string>& force_incremental_names
81 CacheControl(CacheControl&&) =
delete;
82 CacheControl& operator=(CacheControl&&) =
delete;
87 explicit UnitTests() =
default;
90 enum class ExecPolicy {
95 CacheControl(impl::PeriodicUpdatesMode, UnitTests);
97 impl::PeriodicUpdatesMode,
100 impl::CacheReverseDependencies reverse_dependencies
105 bool IsPeriodicUpdateEnabled(
const cache::Config& cache_config,
const std::string& cache_name)
const;
111 template <
typename Component>
112 CacheResetRegistration RegisterCache(Component* self, std::string_view name,
void (Component::*reset_method)());
114 struct CacheInfo
final {
117 bool needs_span{
true};
119 struct CacheInfoNode;
120 using CacheInfoIterator = CacheInfoNode*;
123 CacheInfoIterator DoRegisterCache(CacheInfo&& info);
126 friend class CacheResetRegistration;
132 std::unordered_set<std::string>* reset_only_names,
133 const std::unordered_set<std::string>& force_incremental_names,
134 const std::unordered_set<std::string>* exclude_names
137 void DoResetCachesConcurrently(
139 std::unordered_set<std::string>* reset_only_names,
140 const std::unordered_set<std::string>& force_incremental_names,
141 const std::unordered_set<std::string>* exclude_names
144 void UnregisterCache(CacheInfoIterator)
noexcept;
146 static void DoResetSingleCache(
147 const CacheInfo& info,
149 const std::unordered_set<std::string>& force_incremental_names
153 std::unique_ptr<Impl> impl_;
161class [[nodiscard]] CacheResetRegistration
final {
163 CacheResetRegistration()
noexcept;
165 CacheResetRegistration(CacheResetRegistration&&)
noexcept;
166 CacheResetRegistration& operator=(CacheResetRegistration&&)
noexcept;
167 ~CacheResetRegistration();
175 CacheResetRegistration(CacheControl&, CacheControl::CacheInfoIterator);
179 CacheControl* cache_control_{
nullptr};
180 CacheControl::CacheInfoIterator cache_info_iterator_{};
208[[deprecated(
"Remove 'config' parameter from RegisterCache call")]] CacheResetRegistration
RegisterCache(
212 void (Component::*reset_method)()
214 return testsuite::RegisterCache(context, self, reset_method);