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

index 3313d17f038c63a189de4a72ac898557d640d0db..534621d044919b6f2bf650137ca88940922519e5 100644 (file)
@@ -41,24 +41,10 @@ public:
     out << "EExport " << base << " " << metablob;
   }
 
-  void encode(bufferlist& bl) const {
-    __u8 struct_v = 2;
-    ::encode(struct_v, bl);
-    ::encode(stamp, bl);
-    ::encode(metablob, bl);
-    ::encode(base, bl);
-    ::encode(bounds, bl);
-  }
-  void decode(bufferlist::iterator &bl) {
-    __u8 struct_v;
-    ::decode(struct_v, bl);
-    if (struct_v >= 2)
-      ::decode(stamp, bl);
-    ::decode(metablob, bl);
-    ::decode(base, bl);
-    ::decode(bounds, bl);
-  }
-  
+  void encode(bufferlist& bl) const;
+  void decode(bufferlist::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<EExport*>& ls);
   void replay(MDS *mds);
 
 };
index 8e522279d10e762c845cf8d1060c73a673224fc6..6c3977584e768aa1e9e0b23301384a28e1471e67 100644 (file)
@@ -1387,6 +1387,47 @@ void EExport::replay(MDS *mds)
   mds->mdcache->try_trim_non_auth_subtree(dir);
 }
 
+void EExport::encode(bufferlist& bl) const
+{
+  ENCODE_START(3, 3, bl);
+  ::encode(stamp, bl);
+  ::encode(metablob, bl);
+  ::encode(base, bl);
+  ::encode(bounds, bl);
+  ENCODE_FINISH(bl);
+}
+
+void EExport::decode(bufferlist::iterator &bl)
+{
+  DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+  if (struct_v >= 2)
+    ::decode(stamp, bl);
+  ::decode(metablob, bl);
+  ::decode(base, bl);
+  ::decode(bounds, bl);
+  DECODE_FINISH(bl);
+}
+
+void EExport::dump(Formatter *f) const
+{
+  f->dump_float("stamp", (double)stamp);
+  /*f->open_object_section("Metablob");
+  metablob.dump(f); // sadly we don't have this; dunno if we'll get it
+  f->close_section();*/
+  f->dump_stream("base dirfrag") << base;
+  f->open_array_section("bounds dirfrags");
+  for (set<dirfrag_t>::const_iterator i = bounds.begin();
+      i != bounds.end(); ++i) {
+    f->dump_stream("dirfrag") << *i;
+  }
+  f->close_section(); // bounds dirfrags
+}
+
+void EExport::generate_test_instances(list<EExport*>& ls)
+{
+  EExport *sample = new EExport();
+  ls.push_back(sample);
+}
 
 
 // -----------------------
index 68fd7af2cc0ae4b6aeb6ee5a304791b041ea6b33..b9edfd5b53873c77e9a4690e8b360d35c56be0ac 100644 (file)
@@ -126,6 +126,9 @@ TYPE(AnchorServer)
 #include "mds/events/ECommitted.h"
 TYPE(ECommitted)
 
+#include "mds/events/EExport.h"
+TYPE(EExport)
+
 #ifdef WITH_RADOSGW
 
 #include "rgw/rgw_rados.h"