Let PGShardManager::invoke_on_each_shard_seq pass the local shard_services
instance instead of using an additional helper.
The downside of dropping the generic sharded_map_seq helper is that it is
able to support *any* (seastar::)sharded object. However, as shard_services
is the only user of it - directly using the local instance without the
helper seems easier to read.
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit
87d20855809d29d675b44f0f97a2ca859f5bf431)
fref->open_array_section("ops_in_flight");
co_await pg_shard_manager.when_active();
co_await pg_shard_manager.invoke_on_each_shard_seq(
- [f = fref.get()](const auto &shard_services) {
- return shard_services.dump_ops_in_flight(f);
+ [f = fref.get()](const auto &local_service) {
+ return local_service.dump_ops_in_flight(f);
});
fref->close_section();
fref->close_section();
}
}
-/**
- * sharded_map_seq
- *
- * Invokes f on each shard of t sequentially. Caller may assume that
- * f will not be invoked concurrently on multiple cores.
- */
-template <typename T, typename F>
-auto sharded_map_seq(T &t, F &&f) {
- return invoke_on_all_seq(
- [&t, f=std::forward<F>(f)]() mutable {
- return std::invoke(f, t.local());
- });
-}
-
enum class crosscore_type_t {
ONE, // from 1 to 1 core
ONE_N, // from 1 to n cores
* invoke_method_on_each_shard_seq
*
* Invokes shard_services method on each shard sequentially.
+ * Following sharded<Service>::invoke_on_all but invoke_on_all_seq
+ * is used to support errorated return types.
*/
template <typename F, typename... Args>
seastar::future<> invoke_on_each_shard_seq(
F &&f) const {
- return sharded_map_seq(
- shard_services,
- [f=std::forward<F>(f)](const ShardServices &shard_services) mutable {
- return std::invoke(
- f,
- shard_services);
- });
+ return invoke_on_all_seq(
+ [this, f=std::forward<F>(f)]() mutable {
+ return std::invoke(f, shard_services.local());
+ });
}
/**