]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common/operation: add OpRegistryT::for_each_op
authorSamuel Just <sjust@redhat.com>
Wed, 28 Sep 2022 23:10:15 +0000 (16:10 -0700)
committerSamuel Just <sjust@redhat.com>
Sat, 1 Oct 2022 22:12:08 +0000 (15:12 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/operation.h

index c39ecea37a786399f227236e0016e97022dbf547..9922ddccfc26c26c4f83d156c64f7b92f0cab551 100644 (file)
@@ -441,6 +441,16 @@ protected:
   }
 
 public:
+  /// Iterate over live ops
+  template <typename F>
+  void for_each_op(F &&f) const {
+    for (const auto &registry: registries) {
+      for (const auto &op: registry) {
+       std::invoke(f, op);
+      }
+    }
+  }
+
   /// Removes op from registry
   void remove_from_registry(Operation &op) {
     const auto op_type = op.get_type();