]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/net: expose the connection working shard to users
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 2 Jun 2023 10:09:18 +0000 (18:09 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Sun, 25 Jun 2023 03:57:19 +0000 (11:57 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/net/Connection.h
src/crimson/net/SocketConnection.h

index d8336e524313daa62f953d8c9dd2835dddb2e4a0..4339e41f0c2dbd8f77ebe8efe3a1fffeb87de26d 100644 (file)
@@ -40,6 +40,15 @@ class Connection : public seastar::enable_shared_from_this<Connection> {
 
   virtual ~Connection() {}
 
+  /**
+   * get_shard_id
+   *
+   * The shard id where the Connection is dispatching events and handling I/O.
+   *
+   * May be changed with the accept/connect events.
+   */
+  virtual const seastar::shard_id get_shard_id() const = 0;
+
   virtual const entity_name_t &get_peer_name() const = 0;
 
   entity_type_t get_peer_type() const { return get_peer_name().type(); }
index 5fd70049aabd3a8c7c60e3763b0279504f0e3f2b..102e179583127a0a1224db14409a24a828081d2b 100644 (file)
@@ -36,6 +36,8 @@ class Interceptor;
  * ConnectionHandler
  *
  * The interface class to implement Connection, called by SocketConnection.
+ *
+ * The operations must be done in get_shard_id().
  */
 class ConnectionHandler {
 public:
@@ -69,13 +71,20 @@ protected:
 };
 
 class SocketConnection : public Connection {
- // Connection interfaces, public to users
+ /*
+  * Connection interfaces, public to users
+  * Working in ConnectionHandler::get_shard_id()
+  */
  public:
   SocketConnection(SocketMessenger& messenger,
                    ChainedDispatchers& dispatchers);
 
   ~SocketConnection() override;
 
+  const seastar::shard_id get_shard_id() const override {
+    return io_handler->get_shard_id();
+  }
+
   const entity_name_t &get_peer_name() const override {
     return peer_name;
   }