]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Monitor: forward-declare class MMonCommand
authorMax Kellermann <max.kellermann@ionos.com>
Fri, 15 Aug 2025 17:02:57 +0000 (19:02 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Tue, 16 Sep 2025 10:42:05 +0000 (12:42 +0200)
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 198b58a2266b354abe0fef81d3a5e519df98c942..7a3f0492151723e032b98d7ac1f191a9814ef831 100644 (file)
@@ -39,6 +39,7 @@
 #include "MonitorDBStore.h"
 
 #include "messages/PaxosServiceMessage.h"
+#include "messages/MMonCommand.h"
 #include "messages/MMonMap.h"
 #include "messages/MMonGetMap.h"
 #include "messages/MMonGetVersion.h"
@@ -146,6 +147,42 @@ static ostream& _prefix(std::ostream *_dout, const Monitor *mon) {
                << "(" << mon->get_state_name() << ") e" << mon->monmap->get_epoch() << " ";
 }
 
+void Monitor::C_Command::_finish(int r) {
+  auto m = op->get_req<MMonCommand>();
+  if (r >= 0) {
+    std::ostringstream ss;
+    if (!op->get_req()->get_connection()) {
+      ss << "connection dropped for command ";
+    } else {
+      MonSession *s = op->get_session();
+
+      // if client drops we may not have a session to draw information from.
+      if (s) {
+       ss << "from='" << s->name << " " << s->addrs << "' "
+          << "entity='" << s->entity_name << "' ";
+      } else {
+       ss << "session dropped for command ";
+      }
+    }
+    cmdmap_t cmdmap;
+    std::ostringstream ds;
+    std::string prefix;
+    cmdmap_from_json(m->cmd, &cmdmap, ds);
+    cmd_getval(cmdmap, "prefix", prefix);
+    if (prefix != "config set" && prefix != "config-key set")
+      ss << "cmd='" << m->cmd << "': finished";
+
+    mon.audit_clog->info() << ss.str();
+    mon.reply_command(op, rc, rs, rdata, version);
+  }
+  else if (r == -ECANCELED)
+    return;
+  else if (r == -EAGAIN)
+    mon.dispatch_op(op);
+  else
+    ceph_abort_msg("bad C_Command return value");
+}
+
 const string Monitor::MONITOR_NAME = "monitor";
 const string Monitor::MONITOR_STORE_PREFIX = "monitor_store";
 
index 2830e0ef8b0220b5a0f9a9138e62367de8f674c1..43d90443a2477f336e4ed953369d24eff43d9493 100644 (file)
@@ -49,7 +49,6 @@
 #include "auth/AuthMethodList.h"
 #include "auth/KeyRing.h"
 #include "include/common_fwd.h"
-#include "messages/MMonCommand.h"
 #include "mon/MonitorDBStore.h"
 #include "mgr/MgrClient.h"
 #include <boost/smart_ptr/atomic_shared_ptr.hpp>
@@ -913,41 +912,7 @@ public:
     C_Command(Monitor &_mm, MonOpRequestRef _op, int r, std::string s, ceph::buffer::list rd, version_t v) :
       C_MonOp(_op), mon(_mm), rc(r), rs(s), rdata(rd), version(v){}
 
-    void _finish(int r) override {
-      auto m = op->get_req<MMonCommand>();
-      if (r >= 0) {
-       std::ostringstream ss;
-        if (!op->get_req()->get_connection()) {
-          ss << "connection dropped for command ";
-        } else {
-          MonSession *s = op->get_session();
-
-          // if client drops we may not have a session to draw information from.
-          if (s) {
-            ss << "from='" << s->name << " " << s->addrs << "' "
-              << "entity='" << s->entity_name << "' ";
-          } else {
-            ss << "session dropped for command ";
-          }
-        }
-        cmdmap_t cmdmap;
-        std::ostringstream ds;
-        std::string prefix;
-        cmdmap_from_json(m->cmd, &cmdmap, ds);
-        cmd_getval(cmdmap, "prefix", prefix);
-        if (prefix != "config set" && prefix != "config-key set")
-          ss << "cmd='" << m->cmd << "': finished";
-
-        mon.audit_clog->info() << ss.str();
-        mon.reply_command(op, rc, rs, rdata, version);
-      }
-      else if (r == -ECANCELED)
-        return;
-      else if (r == -EAGAIN)
-        mon.dispatch_op(op);
-      else
-       ceph_abort_msg("bad C_Command return value");
-    }
+    void _finish(int r) override;
   };
 
  private: