]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: dump() entity_name_t and entity_addr_t
authorSage Weil <sage.weil@dreamhost.com>
Mon, 16 Jan 2012 19:36:39 +0000 (11:36 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Mon, 23 Jan 2012 04:41:05 +0000 (20:41 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/msg/msg_types.cc
src/msg/msg_types.h

index 35da88b8b0f3e4e677f0142fa72f36981d39abff..36f9cb9fb77da88610057ac266fb1737cc0cf573 100644 (file)
@@ -5,6 +5,22 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "common/Formatter.h"
+
+void entity_name_t::dump(Formatter *f) const
+{
+  f->dump_string("type", type_str());
+  f->dump_unsigned("num", num());
+}
+
+
+void entity_addr_t::dump(Formatter *f) const
+{
+  f->dump_unsigned("nonce", nonce);
+  f->dump_stream("addr") << addr;
+}
+
+
 bool entity_addr_t::parse(const char *s, const char **end)
 {
   memset(this, 0, sizeof(*this));
index 679869511ad6a5923ca9c377d46adc6450da80fd..682fe1be937ff5ec585f5b61229e6e7139d8d360 100644 (file)
 #include "tcp.h"
 #include "include/encoding.h"
 
+namespace ceph {
+  class Formatter;
+}
 
 extern ostream& operator<<(ostream& out, const sockaddr_storage &ss);
 
-
 class entity_name_t {
 public:
   __u8 _type;
@@ -105,6 +107,7 @@ public:
     ::decode(_type, bl);
     ::decode(_num, bl);
   }
+  void dump(Formatter *f) const;
 };
 WRITE_CLASS_ENCODER(entity_name_t)
 
@@ -317,6 +320,9 @@ struct entity_addr_t {
     ::decode(nonce, bl);
     ::decode(addr, bl);
   }
+
+  void dump(Formatter *f) const;
+
 };
 WRITE_CLASS_ENCODER(entity_addr_t)