]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/DaemonHealthMetric: un-inline methods to reduce header dependencies
authorMax Kellermann <max.kellermann@ionos.com>
Thu, 14 Aug 2025 08:53:50 +0000 (10:53 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Wed, 8 Apr 2026 11:26:58 +0000 (13:26 +0200)
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/CMakeLists.txt
src/mgr/DaemonHealthMetric.cc [new file with mode: 0644]
src/mgr/DaemonHealthMetric.h

index c0732cb43eef6a3448b807de1975a2176be9ae35..e323eb92cda250056fa8222f5073e4ff93d3941f 100644 (file)
@@ -537,6 +537,7 @@ set(libcommon_files
   mon/MonMap.cc
   mon/MonSub.cc
   mon/error_code.cc
+  mgr/DaemonHealthMetric.cc
   mgr/MgrClient.cc
   mon/MgrMap.cc
   mon/PGMap.cc
diff --git a/src/mgr/DaemonHealthMetric.cc b/src/mgr/DaemonHealthMetric.cc
new file mode 100644 (file)
index 0000000..eb79de9
--- /dev/null
@@ -0,0 +1,27 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "DaemonHealthMetric.h"
+
+#include <ostream>
+
+#include "common/Formatter.h"
+
+void DaemonHealthMetric::dump(ceph::Formatter *f) const {
+  f->dump_string("type", get_type_name());
+  f->dump_int("n", get_n());
+  f->dump_int("n1", get_n1());
+  f->dump_int("n2", get_n2());
+}
+
+std::list<DaemonHealthMetric> DaemonHealthMetric::generate_test_instances() {
+  std::list<DaemonHealthMetric> o;
+  o.push_back(DaemonHealthMetric(daemon_metric::SLOW_OPS, 1));
+  o.push_back(DaemonHealthMetric(daemon_metric::PENDING_CREATING_PGS, 1, 2));
+  return o;
+}
+
+std::ostream& operator<<(std::ostream& out, const DaemonHealthMetric& m) {
+  return out << daemon_metric_name(m.get_type()) << "("
+            << m.get_n() << "|(" << m.get_n1() << "," << m.get_n2() << "))";
+}
index 8081d0a611d25f7169020ed83cb9946c8be477fb..26381375fb81e8031339fee74f2ea5f5acb295ca 100644 (file)
@@ -5,11 +5,11 @@
 
 #include <cstdint>
 #include <list>
-#include <ostream>
+#include <iosfwd>
 #include <string>
-#include "common/Formatter.h"
 #include "include/denc.h"
-#include "common/Formatter.h"
+
+namespace ceph { class Formatter; }
 
 enum class daemon_metric : uint8_t {
   SLOW_OPS,
@@ -70,26 +70,13 @@ public:
     denc(v.value.n, p);
     DENC_FINISH(p);
   }
-  void dump(Formatter *f) const {
-    f->dump_string("type", get_type_name());
-    f->dump_int("n", get_n());
-    f->dump_int("n1", get_n1());
-    f->dump_int("n2", get_n2());
-  }
-  static std::list<DaemonHealthMetric> generate_test_instances() {
-    std::list<DaemonHealthMetric> o;
-    o.push_back(DaemonHealthMetric(daemon_metric::SLOW_OPS, 1));
-    o.push_back(DaemonHealthMetric(daemon_metric::PENDING_CREATING_PGS, 1, 2));
-    return o;
-  }
+  void dump(ceph::Formatter *f) const;
+  static std::list<DaemonHealthMetric> generate_test_instances();
   std::string get_type_name() const {
     return daemon_metric_name(get_type());
   }
 
-  friend std::ostream& operator<<(std::ostream& out, const DaemonHealthMetric& m) {
-    return out << daemon_metric_name(m.get_type()) << "("
-              << m.get_n() << "|(" << m.get_n1() << "," << m.get_n2() << "))";
-  }
+  friend std::ostream& operator<<(std::ostream& out, const DaemonHealthMetric& m);
 private:
   daemon_metric type = daemon_metric::NONE;
   daemon_metric_t value;