]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: ESession more modernization for dencoder
authorGreg Farnum <greg@inktank.com>
Sun, 3 Feb 2013 23:45:31 +0000 (15:45 -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/ESession.h
src/mds/journal.cc
src/test/encoding/types.h

index 74af3fd8815391697368357290f0482d466396a2..e2e269fa4298a521bcd201b202871159fc36cba8 100644 (file)
@@ -46,28 +46,10 @@ class ESession : public LogEvent {
     cmapv(v),
     inos(i), inotablev(iv) { }
 
-  void encode(bufferlist &bl) const {
-    ENCODE_START(3, 3, bl);
-    ::encode(stamp, bl);
-    ::encode(client_inst, bl);
-    ::encode(open, bl);
-    ::encode(cmapv, bl);
-    ::encode(inos, bl);
-    ::encode(inotablev, bl);
-    ENCODE_FINISH(bl);
-  }
-  void decode(bufferlist::iterator &bl) {
-    DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
-    if (struct_v >= 2)
-      ::decode(stamp, bl);
-    ::decode(client_inst, bl);
-    ::decode(open, bl);
-    ::decode(cmapv, bl);
-    ::decode(inos, bl);
-    ::decode(inotablev, bl);
-    DECODE_FINISH(bl);
-  }
-
+  void encode(bufferlist& bl) const;
+  void decode(bufferlist::iterator& bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<ESession*>& ls);
 
   void print(ostream& out) {
     if (open)
index 81dcc087b88ae937344206bb76d2cf03889dcb44..4a7c750b641d401c935a9c7e84e76e65cc9d65f1 100644 (file)
@@ -1374,6 +1374,48 @@ void ESession::replay(MDS *mds)
   update_segment();
 }
 
+void ESession::encode(bufferlist &bl) const
+{
+  ENCODE_START(3, 3, bl);
+  ::encode(stamp, bl);
+  ::encode(client_inst, bl);
+  ::encode(open, bl);
+  ::encode(cmapv, bl);
+  ::encode(inos, bl);
+  ::encode(inotablev, bl);
+  ENCODE_FINISH(bl);
+}
+
+void ESession::decode(bufferlist::iterator &bl)
+{
+  DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+  if (struct_v >= 2)
+    ::decode(stamp, bl);
+  ::decode(client_inst, bl);
+  ::decode(open, bl);
+  ::decode(cmapv, bl);
+  ::decode(inos, bl);
+  ::decode(inotablev, bl);
+  DECODE_FINISH(bl);
+}
+
+void ESession::dump(Formatter *f) const
+{
+  f->dump_stream("client instance") << client_inst;
+  f->dump_string("open", open ? "true" : "false");
+  f->dump_int("client map version", cmapv);
+  f->dump_stream("inos") << inos;
+  f->dump_int("inotable version", inotablev);
+}
+
+void ESession::generate_test_instances(list<ESession*>& ls)
+{
+  ls.push_back(new ESession);
+}
+
+// -----------------------
+// ESession
+
 void ESessions::update_segment()
 {
   _segment->sessionmapv = cmapv;
index e1c23c91a545faa385923115ea24fdfba74a3e7d..75a73e11e5eada1dba818086c373eb227b83d8bc 100644 (file)
@@ -143,6 +143,8 @@ TYPE(EMetaBlob)
 TYPE(EOpen)
 #include "mds/events/EResetJournal.h"
 TYPE(EResetJournal)
+#include "mds/events/ESession.h"
+TYPE(ESession)
 
 #ifdef WITH_RADOSGW