]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: EImportFinish event uses modern encoding
authorGreg Farnum <greg@inktank.com>
Thu, 31 Jan 2013 21:53:10 +0000 (13:53 -0800)
committerGreg Farnum <greg@inktank.com>
Fri, 8 Feb 2013 21:17:52 +0000 (13:17 -0800)
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/events/EImportFinish.h
src/mds/journal.cc
src/test/encoding/types.h

index 85f0eb16cabb2d2fa884fabf2334a97ff04faf7b..7ed25e15bef9abbdd0bc539eb72bc21f8495cda3 100644 (file)
@@ -30,9 +30,9 @@ class EImportFinish : public LogEvent {
   EImportFinish(CDir *dir, bool s) : LogEvent(EVENT_IMPORTFINISH), 
                                     base(dir->dirfrag()),
                                     success(s) { }
-  EImportFinish() : LogEvent(EVENT_IMPORTFINISH) { }
+  EImportFinish() : LogEvent(EVENT_IMPORTFINISH), base(), success(false) { }
   
-  void print(ostream& out) {
+  void print(ostream& out) const {
     out << "EImportFinish " << base;
     if (success)
       out << " success";
@@ -40,21 +40,10 @@ class EImportFinish : public LogEvent {
       out << " failed";
   }
 
-  void encode(bufferlist& bl) const {
-    __u8 struct_v = 2;
-    ::encode(struct_v, bl);
-    ::encode(stamp, bl);
-    ::encode(base, bl);
-    ::encode(success, bl);
-  }
-  void decode(bufferlist::iterator &bl) {
-    __u8 struct_v;
-    ::decode(struct_v, bl);
-    if (struct_v >= 2)
-      ::decode(stamp, bl);
-    ::decode(base, bl);
-    ::decode(success, bl);
-  }
+  void encode(bufferlist& bl) const;
+  void decode(bufferlist::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<EImportFinish*>& ls);
   
   void replay(MDS *mds);
 
index 23142599f05b3ce9509f5540931f273b62b81c3e..2e517f4cf700e5b7050b7a35e5782d4e2533e000 100644 (file)
@@ -1529,6 +1529,36 @@ void EImportFinish::replay(MDS *mds)
   }
 }
 
+void EImportFinish::encode(bufferlist& bl) const
+{
+  ENCODE_START(3, 3, bl);
+  ::encode(stamp, bl);
+  ::encode(base, bl);
+  ::encode(success, bl);
+  ENCODE_FINISH(bl);
+}
+
+void EImportFinish::decode(bufferlist::iterator &bl)
+{
+  DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+  if (struct_v >= 2)
+    ::decode(stamp, bl);
+  ::decode(base, bl);
+  ::decode(success, bl);
+  DECODE_FINISH(bl);
+}
+
+void EImportFinish::dump(Formatter *f) const
+{
+  f->dump_stream("base dirfrag") << base;
+  f->dump_string("success", success ? "true" : "false");
+}
+void EImportFinish::generate_test_instances(list<EImportFinish*>& ls)
+{
+  ls.push_back(new EImportFinish);
+  ls.push_back(new EImportFinish);
+  ls.back()->success = true;
+}
 
 
 // ------------------------
index a7fe3f6d257f83479770f71ea2a7715e99fb3b3a..dc90de4d2d3910f0691d489afb6ff1216fb2073e 100644 (file)
@@ -129,6 +129,8 @@ TYPE(ECommitted)
 TYPE(EExport)
 #include "mds/events/EFragment.h"
 TYPE(EFragment)
+#include "mds/events/EImportFinish.h"
+TYPE(EImportFinish)
 
 #ifdef WITH_RADOSGW