File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed
Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 44#pragma once
55
66#include " crimson/common/operation.h"
7+ #include " crimson/net/Connection.h"
78#include " crimson/osd/pg_interval_interrupt_condition.h"
89#include " crimson/osd/scheduler/scheduler.h"
910#include " osd/osd_types.h"
@@ -165,6 +166,61 @@ struct OperationT : InterruptibleOperation {
165166 virtual void dump_detail (ceph::Formatter *f) const = 0;
166167};
167168
169+ class RemoteOperation {
170+ crimson::net::ConnectionRef l_conn;
171+ crimson::net::ConnectionXcoreRef r_conn;
172+
173+ public:
174+ RemoteOperation (crimson::net::ConnectionRef &&conn)
175+ : l_conn(std::move(conn)) {}
176+
177+ crimson::net::Connection &get_local_connection () {
178+ assert (l_conn);
179+ assert (!r_conn);
180+ return *l_conn;
181+ };
182+
183+ crimson::net::Connection &get_foreign_connection () {
184+ assert (r_conn);
185+ assert (!l_conn);
186+ return *r_conn;
187+ };
188+
189+ crimson::net::ConnectionFFRef prepare_remote_submission () {
190+ assert (l_conn);
191+ assert (!r_conn);
192+ auto ret = seastar::make_foreign (std::move (l_conn));
193+ l_conn.reset ();
194+ return ret;
195+ }
196+
197+ void finish_remote_submission (crimson::net::ConnectionFFRef conn) {
198+ assert (conn);
199+ assert (!l_conn);
200+ assert (!r_conn);
201+ r_conn = make_local_shared_foreign (std::move (conn));
202+ }
203+
204+ crimson::net::Connection &get_connection () const {
205+ if (l_conn) {
206+ return *l_conn;
207+ } else {
208+ assert (r_conn);
209+ return *r_conn;
210+ }
211+ }
212+
213+ /* *
214+ * get_remote_connection
215+ *
216+ * Return a reference to the remote connection to allow caller to
217+ * perform a copy only as needed.
218+ */
219+ crimson::net::ConnectionXcoreRef &get_remote_connection () {
220+ return r_conn;
221+ }
222+ };
223+
168224template <class T >
169225class TrackableOperationT : public OperationT <T> {
170226 T* that () {
You can’t perform that action at this time.
0 commit comments