From: Yingxin Cheng Date: Fri, 2 Jun 2023 10:09:18 +0000 (+0800) Subject: crimson/net: expose the connection working shard to users X-Git-Tag: v18.2.1~166^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6565a62fb843befcec0069a4e5544779db1eadf;p=ceph.git crimson/net: expose the connection working shard to users Signed-off-by: Yingxin Cheng (cherry picked from commit b2a456d6b86e0105397f66fb1576acb37d650c56) --- diff --git a/src/crimson/net/Connection.h b/src/crimson/net/Connection.h index d8336e524313..4339e41f0c2d 100644 --- a/src/crimson/net/Connection.h +++ b/src/crimson/net/Connection.h @@ -40,6 +40,15 @@ class Connection : public seastar::enable_shared_from_this { 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(); } diff --git a/src/crimson/net/SocketConnection.h b/src/crimson/net/SocketConnection.h index 5fd70049aabd..102e17958312 100644 --- a/src/crimson/net/SocketConnection.h +++ b/src/crimson/net/SocketConnection.h @@ -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; }