diff --git a/replica/database.hh b/replica/database.hh index 91a26eb746..ec9eba8fd4 100644 --- a/replica/database.hh +++ b/replica/database.hh @@ -1110,7 +1110,10 @@ public: void update_off_strategy_trigger(); void enable_off_strategy_trigger(); + // FIXME: get rid of it once no users. compaction::table_state& as_table_state() const noexcept; + // Safely iterate through table states, while performing async operations on them. + future<> parallel_foreach_table_state(std::function(compaction::table_state&)> action); friend class compaction_group; }; diff --git a/replica/table.cc b/replica/table.cc index 0e934b70e2..f9aefe8334 100644 --- a/replica/table.cc +++ b/replica/table.cc @@ -2674,6 +2674,12 @@ compaction::table_state& table::as_table_state() const noexcept { return _compaction_group->as_table_state(); } +future<> table::parallel_foreach_table_state(std::function(table_state&)> action) { + return parallel_foreach_compaction_group([action = std::move(action)] (compaction_group& cg) -> future<> { + return action(cg.as_table_state()); + }); +} + data_dictionary::table table::as_data_dictionary() const { static constinit data_dictionary_impl _impl;