]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #pragma once | |
5 | ||
6 | #include "osd/osd_op_util.h" | |
7 | #include "crimson/net/Connection.h" | |
8 | #include "crimson/osd/osd_operation.h" | |
1e59de90 | 9 | #include "crimson/osd/pg.h" |
f67539c2 | 10 | #include "crimson/common/type_helpers.h" |
20effc67 | 11 | #include "messages/MOSDFastDispatchOp.h" |
f67539c2 TL |
12 | |
13 | namespace crimson::osd { | |
14 | ||
f67539c2 TL |
15 | class PG; |
16 | ||
1e59de90 | 17 | class RecoverySubRequest final : public PhasedOperationT<RecoverySubRequest> { |
f67539c2 | 18 | public: |
1e59de90 TL |
19 | static constexpr OperationTypeCode type = |
20 | OperationTypeCode::background_recovery_sub; | |
f67539c2 | 21 | |
1e59de90 TL |
22 | RecoverySubRequest( |
23 | crimson::net::ConnectionRef conn, | |
24 | Ref<MOSDFastDispatchOp>&& m) | |
25 | : conn(conn), m(m) {} | |
f67539c2 TL |
26 | |
27 | void print(std::ostream& out) const final | |
28 | { | |
29 | out << *m; | |
30 | } | |
31 | ||
32 | void dump_detail(Formatter *f) const final | |
33 | { | |
34 | } | |
35 | ||
1e59de90 TL |
36 | static constexpr bool can_create() { return false; } |
37 | spg_t get_pgid() const { | |
38 | return m->get_spg(); | |
39 | } | |
40 | PipelineHandle &get_handle() { return handle; } | |
41 | epoch_t get_epoch() const { return m->get_min_epoch(); } | |
42 | ||
43 | ConnectionPipeline &get_connection_pipeline(); | |
44 | seastar::future<crimson::net::ConnectionFRef> prepare_remote_submission() { | |
45 | assert(conn); | |
46 | return conn.get_foreign( | |
47 | ).then([this](auto f_conn) { | |
48 | conn.reset(); | |
49 | return f_conn; | |
50 | }); | |
51 | } | |
52 | void finish_remote_submission(crimson::net::ConnectionFRef _conn) { | |
53 | assert(!conn); | |
54 | conn = make_local_shared_foreign(std::move(_conn)); | |
55 | } | |
56 | ||
57 | seastar::future<> with_pg( | |
58 | ShardServices &shard_services, Ref<PG> pg); | |
59 | ||
60 | std::tuple< | |
61 | StartEvent, | |
62 | ConnectionPipeline::AwaitActive::BlockingEvent, | |
63 | ConnectionPipeline::AwaitMap::BlockingEvent, | |
64 | ConnectionPipeline::GetPG::BlockingEvent, | |
65 | PGMap::PGCreationBlockingEvent, | |
66 | OSD_OSDMapGate::OSDMapBlocker::BlockingEvent, | |
67 | CompletionEvent | |
68 | > tracking_events; | |
69 | ||
f67539c2 | 70 | private: |
f67539c2 | 71 | crimson::net::ConnectionRef conn; |
1e59de90 TL |
72 | // must be after `conn` to ensure the ConnectionPipeline's is alive |
73 | PipelineHandle handle; | |
f67539c2 TL |
74 | Ref<MOSDFastDispatchOp> m; |
75 | }; | |
76 | ||
77 | } | |
1e59de90 TL |
78 | |
79 | #if FMT_VERSION >= 90000 | |
80 | template <> struct fmt::formatter<crimson::osd::RecoverySubRequest> : fmt::ostream_formatter {}; | |
81 | #endif |