]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon: move mon::Connection into .cc 24619/head
authorKefu Chai <kchai@redhat.com>
Tue, 16 Oct 2018 15:24:05 +0000 (23:24 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 16 Oct 2018 16:07:41 +0000 (00:07 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/mon/MonClient.cc
src/crimson/mon/MonClient.h
src/test/crimson/test_monc.cc

index b79cc32c710c5dda5012d329a8dd7f1198f7acf3..ab8e53ce8544e02ceaab4a28c69392484dc60fa4 100644 (file)
 #include "crimson/common/config_proxy.h"
 #include "crimson/common/log.h"
 #include "crimson/net/Connection.h"
+#include "crimson/net/Errors.h"
 #include "crimson/net/Messenger.h"
 
 #include "messages/MAuth.h"
+#include "messages/MAuthReply.h"
 #include "messages/MConfig.h"
 #include "messages/MLogAck.h"
 #include "messages/MMonCommand.h"
@@ -42,6 +44,40 @@ namespace {
 
 namespace ceph::mon {
 
+
+class Connection {
+public:
+  Connection(ceph::net::ConnectionRef conn,
+            KeyRing* keyring);
+  seastar::future<> handle_auth_reply(Ref<MAuthReply> m);
+  seastar::future<> authenticate(epoch_t epoch,
+                                const EntityName& name,
+                                const AuthMethodList& auth_methods,
+                                uint32_t want_keys);
+  seastar::future<> close();
+  bool is_my_peer(const entity_addr_t& addr) const;
+
+  seastar::future<> renew_tickets();
+  ceph::net::ConnectionRef get_conn();
+
+private:
+  seastar::future<> setup_session(epoch_t epoch,
+                                 const AuthMethodList& auth_methods,
+                                 const EntityName& name);
+  std::unique_ptr<AuthClientHandler> create_auth(Ref<MAuthReply> m,
+                                                const EntityName& name,
+                                                uint32_t want_keys);
+  seastar::future<bool> do_auth();
+
+private:
+  bool closed = false;
+  seastar::promise<Ref<MAuthReply>> reply;
+  ceph::net::ConnectionRef conn;
+  std::unique_ptr<AuthClientHandler> auth;
+  RotatingKeyRing rotating_keyring;
+  uint64_t global_id;
+};
+
 Connection::Connection(ceph::net::ConnectionRef conn,
                        KeyRing* keyring)
   : conn{conn},
@@ -223,6 +259,9 @@ Client::Client(const EntityName& name,
     msgr{messenger}
 {}
 
+Client::Client(Client&&) = default;
+Client::~Client() = default;
+
 seastar::future<> Client::load_keyring()
 {
   if (!auth_methods.is_supported_auth(CEPH_AUTH_CEPHX)) {
index c4356a61c1f79b1d5df4d28656e73f2b419ee9c4..ed94a4812a862ae4fe0214db2586bb86f47aadfa 100644 (file)
@@ -9,15 +9,12 @@
 #include <seastar/core/lowres_clock.hh>
 #include <seastar/core/timer.hh>
 
-#include "auth/AuthClientHandler.h"
 #include "auth/AuthMethodList.h"
 #include "auth/KeyRing.h"
-#include "auth/RotatingKeyRing.h"
 
-#include "crimson/net/Connection.h"
 #include "crimson/net/Dispatcher.h"
+#include "crimson/net/Fwd.h"
 
-#include "messages/MAuthReply.h"
 #include "mon/MonMap.h"
 
 #include "mon/MonSub.h"
@@ -27,6 +24,7 @@ namespace ceph::net {
   class Messenger;
 }
 
+class MAuthReply;
 struct MMonMap;
 struct MMonSubscribeAck;
 struct MMonGetVersionReply;
@@ -36,38 +34,7 @@ struct MConfig;
 
 namespace ceph::mon {
 
-class Connection {
-public:
-  Connection(ceph::net::ConnectionRef conn,
-            KeyRing* keyring);
-  seastar::future<> handle_auth_reply(Ref<MAuthReply> m);
-  seastar::future<> authenticate(epoch_t epoch,
-                                const EntityName& name,
-                                const AuthMethodList& auth_methods,
-                                uint32_t want_keys);
-  seastar::future<> close();
-  bool is_my_peer(const entity_addr_t& addr) const;
-
-  seastar::future<> renew_tickets();
-  ceph::net::ConnectionRef get_conn();
-
-private:
-  seastar::future<> setup_session(epoch_t epoch,
-                                 const AuthMethodList& auth_methods,
-                                 const EntityName& name);
-  std::unique_ptr<AuthClientHandler> create_auth(Ref<MAuthReply> m,
-                                                const EntityName& name,
-                                                uint32_t want_keys);
-  seastar::future<bool> do_auth();
-
-private:
-  bool closed = false;
-  seastar::promise<Ref<MAuthReply>> reply;
-  ceph::net::ConnectionRef conn;
-  std::unique_ptr<AuthClientHandler> auth;
-  RotatingKeyRing rotating_keyring;
-  uint64_t global_id;
-};
+class Connection;
 
 class Client : public ceph::net::Dispatcher {
   const EntityName entity_name;
@@ -100,6 +67,8 @@ class Client : public ceph::net::Dispatcher {
 public:
   Client(const EntityName& name,
         ceph::net::Messenger& messenger);
+  Client(Client&&);
+  ~Client();
   seastar::future<> load_keyring();
   seastar::future<> build_initial_map();
   seastar::future<> authenticate(std::chrono::seconds seconds);
index 16cfe3b7111d223c747b79872b33b97168a70ef4..0df9b13791a3890276b39ea4d557e5afe194a25f 100644 (file)
@@ -2,6 +2,7 @@
 #include "common/ceph_argparse.h"
 #include "crimson/common/config_proxy.h"
 #include "crimson/mon/MonClient.h"
+#include "crimson/net/Connection.h"
 #include "crimson/net/SocketMessenger.h"
 
 using Config = ceph::common::ConfigProxy;