]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/msg_types: un-inline methods to reduce header dependencies
authorMax Kellermann <max.kellermann@ionos.com>
Fri, 25 Oct 2024 06:54:27 +0000 (08:54 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Wed, 18 Mar 2026 10:51:00 +0000 (11:51 +0100)
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/msg/msg_types.cc
src/msg/msg_types.h

index e368c652dc867b0c4f319a1ad927159c3175b735..5aa63a7b97b6883f60477f87874eb64340948fdf 100644 (file)
@@ -8,9 +8,12 @@
 #include <string.h>
 #include <netdb.h>
 
+#include <sstream>
+
 #include <fmt/format.h>
 
 #include "common/Formatter.h"
+#include "include/types.h"
 
 bool entity_name_t::parse(std::string_view s)
 {
@@ -417,6 +420,16 @@ std::list<entity_addrvec_t> entity_addrvec_t::generate_test_instances()
   return ls;
 }
 
+std::ostream& operator<<(std::ostream& out, const entity_addrvec_t& av) {
+  if (av.v.empty()) {
+    return out;
+  } else if (av.v.size() == 1) {
+    return out << av.v[0];
+  } else {
+    return out << av.v;
+  }
+}
+
 std::string entity_addr_t::ip_only_to_str() const 
 {
   const char *host_ip = NULL;
@@ -444,3 +457,9 @@ std::string entity_addr_t::ip_n_port_to_str() const
     return fmt::format("{}:{}", ip_only_to_str(), get_port());
   }
 }
+
+std::string entity_addr_t::get_legacy_str() const {
+  std::ostringstream ss;
+  ss << get_sockaddr() << "/" << get_nonce();
+  return ss.str();
+}
index f823ad7e87c3d9821530e18aa405bb670b7fde35..27d5a959357d3941ed35c6ee08f569605d038dfd 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <algorithm> // for std::min()
 #include <set>
-#include <sstream>
 #include <string>
 
 #include <netinet/in.h>
@@ -28,7 +27,6 @@
 #endif
 
 #include "include/ceph_features.h"
-#include "include/types.h"
 #include "include/blobhash.h"
 #include "include/encoding.h"
 #include "include/msgr.h" // for CEPH_ENTITY_TYPE_*
@@ -446,11 +444,7 @@ struct entity_addr_t {
   std::string ip_only_to_str() const;
   std::string ip_n_port_to_str() const;
 
-  std::string get_legacy_str() const {
-    std::ostringstream ss;
-    ss << get_sockaddr() << "/" << get_nonce();
-    return ss.str();
-  }
+  std::string get_legacy_str() const;
 
   bool parse(const std::string_view s, int default_type=TYPE_DEFAULT);
   bool parse(const char *s, const char **end = 0, int default_type=TYPE_DEFAULT);
@@ -730,15 +724,7 @@ struct entity_addrvec_t {
     return false;
   }
 
-  friend std::ostream& operator<<(std::ostream& out, const entity_addrvec_t& av) {
-    if (av.v.empty()) {
-      return out;
-    } else if (av.v.size() == 1) {
-      return out << av.v[0];
-    } else {
-      return out << av.v;
-    }
-  }
+  friend std::ostream& operator<<(std::ostream& out, const entity_addrvec_t& av);
 
   friend bool operator==(const entity_addrvec_t& l, const entity_addrvec_t& r) {
     return l.v == r.v;