]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: ESessions more modernization for dencoder
authorGreg Farnum <greg@inktank.com>
Mon, 4 Feb 2013 00:07:44 +0000 (16:07 -0800)
committerGreg Farnum <greg@inktank.com>
Fri, 8 Feb 2013 21:17:53 +0000 (13:17 -0800)
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/events/ESessions.h
src/mds/journal.cc
src/test/encoding/types.h

index ebc5edaec92b0107914480f0283199c5d854ffd3..e239a0da8e9748d6577de006f03a957929cf5407 100644 (file)
@@ -37,33 +37,16 @@ public:
   }
 
   void mark_old_encoding() { old_style_encode = true; }
-  
-  void encode(bufferlist &bl) const {
-    ENCODE_START(1, 1, bl);
-    ::encode(client_map, bl);
-    ::encode(cmapv, bl);
-    ::encode(stamp, bl);
-    ENCODE_FINISH(bl);
-  }
-  void decode_old(bufferlist::iterator &bl) {
-    ::decode(client_map, bl);
-    ::decode(cmapv, bl);
-    if (!bl.end())
-      ::decode(stamp, bl);
-  }
-  void decode_new(bufferlist::iterator &bl) {
-    DECODE_START(1, bl);
-    ::decode(client_map, bl);
-    ::decode(cmapv, bl);
-    if (!bl.end())
-      ::decode(stamp, bl);
-    DECODE_FINISH(bl);
-  }
+
+  void encode(bufferlist &bl) const;
+  void decode_old(bufferlist::iterator &bl);
+  void decode_new(bufferlist::iterator &bl);
   void decode(bufferlist::iterator &bl) {
     if (old_style_encode) decode_old(bl);
     else decode_new(bl);
   }
-
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<ESessions*>& ls);
 
   void print(ostream& out) {
     out << "ESessions " << client_map.size() << " opens cmapv " << cmapv;
index 3968eee7dac5864b5a10b75f8839523c4b6b8d46..1e1280585aef67bb667d01024cd96e39b39dd7ff 100644 (file)
@@ -1416,6 +1416,53 @@ void ESession::generate_test_instances(list<ESession*>& ls)
 // -----------------------
 // ESessions
 
+void ESessions::encode(bufferlist &bl) const
+{
+  ENCODE_START(1, 1, bl);
+  ::encode(client_map, bl);
+  ::encode(cmapv, bl);
+  ::encode(stamp, bl);
+  ENCODE_FINISH(bl);
+}
+
+void ESessions::decode_old(bufferlist::iterator &bl)
+{
+  ::decode(client_map, bl);
+  ::decode(cmapv, bl);
+  if (!bl.end())
+    ::decode(stamp, bl);
+}
+
+void ESessions::decode_new(bufferlist::iterator &bl)
+{
+  DECODE_START(1, bl);
+  ::decode(client_map, bl);
+  ::decode(cmapv, bl);
+  if (!bl.end())
+    ::decode(stamp, bl);
+  DECODE_FINISH(bl);
+}
+
+void ESessions::dump(Formatter *f) const
+{
+  f->dump_int("client map version", cmapv);
+
+  f->open_array_section("client map");
+  for (map<client_t,entity_inst_t>::const_iterator i = client_map.begin();
+       i != client_map.end(); ++i) {
+    f->open_object_section("client");
+    f->dump_int("client id", i->first.v);
+    f->dump_stream("client entity") << i->second;
+    f->close_section(); // client
+  }
+  f->close_section(); // client map
+}
+
+void ESessions::generate_test_instances(list<ESessions*>& ls)
+{
+  ls.push_back(new ESessions());
+}
+
 void ESessions::update_segment()
 {
   _segment->sessionmapv = cmapv;
index 75a73e11e5eada1dba818086c373eb227b83d8bc..2e4cd8210dbc4674ac17356e11bc961f91b3e81d 100644 (file)
@@ -145,6 +145,8 @@ TYPE(EOpen)
 TYPE(EResetJournal)
 #include "mds/events/ESession.h"
 TYPE(ESession)
+#include "mds/events/ESessions.h"
+TYPE(ESessions)
 
 #ifdef WITH_RADOSGW