]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/crimson/osd/osd_operations/recovery_subrequest.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / crimson / osd / osd_operations / recovery_subrequest.h
index 3127f10bde13ada2fc675342c4f6fe38bc38a63b..07c7c95b5e0fe1396015419e41434d3de12f6ce6 100644 (file)
@@ -6,21 +6,23 @@
 #include "osd/osd_op_util.h"
 #include "crimson/net/Connection.h"
 #include "crimson/osd/osd_operation.h"
-#include "crimson/osd/osd.h"
+#include "crimson/osd/pg.h"
 #include "crimson/common/type_helpers.h"
 #include "messages/MOSDFastDispatchOp.h"
 
 namespace crimson::osd {
 
-class OSD;
 class PG;
 
-class RecoverySubRequest final : public OperationT<RecoverySubRequest> {
+class RecoverySubRequest final : public PhasedOperationT<RecoverySubRequest> {
 public:
-  static constexpr OperationTypeCode type = OperationTypeCode::background_recovery_sub;
+  static constexpr OperationTypeCode type =
+    OperationTypeCode::background_recovery_sub;
 
-  RecoverySubRequest(OSD &osd, crimson::net::ConnectionRef conn, Ref<MOSDFastDispatchOp>&& m)
-    : osd(osd), conn(conn), m(m) {}
+  RecoverySubRequest(
+    crimson::net::ConnectionRef conn,
+    Ref<MOSDFastDispatchOp>&& m)
+    : conn(conn), m(m) {}
 
   void print(std::ostream& out) const final
   {
@@ -31,11 +33,49 @@ public:
   {
   }
 
-  seastar::future<> start();
+  static constexpr bool can_create() { return false; }
+  spg_t get_pgid() const {
+    return m->get_spg();
+  }
+  PipelineHandle &get_handle() { return handle; }
+  epoch_t get_epoch() const { return m->get_min_epoch(); }
+
+  ConnectionPipeline &get_connection_pipeline();
+  seastar::future<crimson::net::ConnectionFRef> prepare_remote_submission() {
+    assert(conn);
+    return conn.get_foreign(
+    ).then([this](auto f_conn) {
+      conn.reset();
+      return f_conn;
+    });
+  }
+  void finish_remote_submission(crimson::net::ConnectionFRef _conn) {
+    assert(!conn);
+    conn = make_local_shared_foreign(std::move(_conn));
+  }
+
+  seastar::future<> with_pg(
+    ShardServices &shard_services, Ref<PG> pg);
+
+  std::tuple<
+    StartEvent,
+    ConnectionPipeline::AwaitActive::BlockingEvent,
+    ConnectionPipeline::AwaitMap::BlockingEvent,
+    ConnectionPipeline::GetPG::BlockingEvent,
+    PGMap::PGCreationBlockingEvent,
+    OSD_OSDMapGate::OSDMapBlocker::BlockingEvent,
+    CompletionEvent
+  > tracking_events;
+
 private:
-  OSD& osd;
   crimson::net::ConnectionRef conn;
+  // must be after `conn` to ensure the ConnectionPipeline's is alive
+  PipelineHandle handle;
   Ref<MOSDFastDispatchOp> m;
 };
 
 }
+
+#if FMT_VERSION >= 90000
+template <> struct fmt::formatter<crimson::osd::RecoverySubRequest> : fmt::ostream_formatter {};
+#endif