]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: EImportStart event uses modern encoding
authorGreg Farnum <greg@inktank.com>
Thu, 31 Jan 2013 22:04:22 +0000 (14:04 -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/EImportStart.h
src/mds/journal.cc
src/test/encoding/types.h

index eaf606a9fcf5c96bed3d871a105563bb681936f3..0f55190139c9dd68f34c7109a2aa5f4b6f156f24 100644 (file)
@@ -40,31 +40,14 @@ protected:
                                       metablob(log) { }
   EImportStart() : LogEvent(EVENT_IMPORTSTART) { }
   
-  void print(ostream& out) {
+  void print(ostream& out) const {
     out << "EImportStart " << base << " " << metablob;
   }
   
-  void encode(bufferlist &bl) const {
-    __u8 struct_v = 2;
-    ::encode(struct_v, bl);
-    ::encode(stamp, bl);
-    ::encode(base, bl);
-    ::encode(metablob, bl);
-    ::encode(bounds, bl);
-    ::encode(cmapv, bl);
-    ::encode(client_map, bl);
-  }
-  void decode(bufferlist::iterator &bl) {
-    __u8 struct_v;
-    ::decode(struct_v, bl);
-    if (struct_v >= 2)
-      ::decode(stamp, bl);
-    ::decode(base, bl);
-    ::decode(metablob, bl);
-    ::decode(bounds, bl);
-    ::decode(cmapv, bl);
-    ::decode(client_map, bl);
-  }
+  void encode(bufferlist &bl) const;
+  void decode(bufferlist::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<EImportStart*>& ls);
   
   void update_segment();
   void replay(MDS *mds);
index 2e517f4cf700e5b7050b7a35e5782d4e2533e000..c0d3d049709ab85a9f47d7a3bc5a16403f40c0b0 100644 (file)
@@ -1503,6 +1503,45 @@ void EImportStart::replay(MDS *mds)
   update_segment();
 }
 
+void EImportStart::encode(bufferlist &bl) const {
+  ENCODE_START(3, 3, bl);
+  ::encode(stamp, bl);
+  ::encode(base, bl);
+  ::encode(metablob, bl);
+  ::encode(bounds, bl);
+  ::encode(cmapv, bl);
+  ::encode(client_map, bl);
+  ENCODE_FINISH(bl);
+}
+
+void EImportStart::decode(bufferlist::iterator &bl) {
+  DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+  if (struct_v >= 2)
+    ::decode(stamp, bl);
+  ::decode(base, bl);
+  ::decode(metablob, bl);
+  ::decode(bounds, bl);
+  ::decode(cmapv, bl);
+  ::decode(client_map, bl);
+  DECODE_FINISH(bl);
+}
+
+void EImportStart::dump(Formatter *f) const
+{
+  f->dump_stream("base dirfrag") << base;
+  f->open_array_section("boundary dirfrags");
+  for (vector<dirfrag_t>::const_iterator iter = bounds.begin();
+      iter != bounds.end(); ++iter) {
+    f->dump_stream("frag") << *iter;
+  }
+  f->close_section();
+}
+
+void EImportStart::generate_test_instances(list<EImportStart*>& ls)
+{
+  ls.push_back(new EImportStart);
+}
+
 // -----------------------
 // EImportFinish
 
index dc90de4d2d3910f0691d489afb6ff1216fb2073e..a6d185d76a03e83debe9c824a81bf03e928740e3 100644 (file)
@@ -131,6 +131,8 @@ TYPE(EExport)
 TYPE(EFragment)
 #include "mds/events/EImportFinish.h"
 TYPE(EImportFinish)
+#include "mds/events/EImportStart.h"
+TYPE(EImportStart)
 
 #ifdef WITH_RADOSGW