]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: ECommitted now uses modern encoding
authorGreg Farnum <greg@inktank.com>
Tue, 5 Feb 2013 19:39:14 +0000 (11:39 -0800)
committerGreg Farnum <greg@inktank.com>
Fri, 8 Feb 2013 21:17:51 +0000 (13:17 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/events/ECommitted.h
src/mds/journal.cc
src/test/encoding/types.h

index dfc84a515e73584e27095ee545c5d03bc5fb50c2..0cb933e2389b9c50d9f6c6cbe239e0a8bf31659f 100644 (file)
@@ -30,19 +30,10 @@ public:
     out << "ECommitted " << reqid;
   }
 
-  void encode(bufferlist &bl) const {
-    __u8 struct_v = 2;
-    ::encode(struct_v, bl);
-    ::encode(stamp, bl);
-    ::encode(reqid, bl);
-  } 
-  void decode(bufferlist::iterator &bl) {
-    __u8 struct_v;
-    ::decode(struct_v, bl);
-    if (struct_v >= 2)
-      ::decode(stamp, bl);
-    ::decode(reqid, bl);
-  }
+  void encode(bufferlist &bl) const;
+  void decode(bufferlist::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<ECommitted*>& ls);
 
   void update_segment() {}
   void replay(MDS *mds);
index d08a9a4415247f45e675a3417c50c064fd330fdd..8e522279d10e762c845cf8d1060c73a673224fc6 100644 (file)
@@ -1112,7 +1112,35 @@ void ECommitted::replay(MDS *mds)
   }
 }
 
+void ECommitted::encode(bufferlist& bl) const
+{
+  ENCODE_START(3, 3, bl);
+  ::encode(stamp, bl);
+  ::encode(reqid, bl);
+  ENCODE_FINISH(bl);
+} 
+
+void ECommitted::decode(bufferlist::iterator& bl)
+{
+  DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+  if (struct_v >= 2)
+    ::decode(stamp, bl);
+  ::decode(reqid, bl);
+  DECODE_FINISH(bl);
+}
 
+void ECommitted::dump(Formatter *f) const {
+  f->dump_stream("stamp") << stamp;
+  f->dump_stream("reqid") << reqid;
+}
+
+void ECommitted::generate_test_instances(list<ECommitted*>& ls)
+{
+  ls.push_back(new ECommitted);
+  ls.push_back(new ECommitted);
+  ls.back()->stamp = utime_t(1, 2);
+  ls.back()->reqid = metareqid_t(entity_name_t::CLIENT(123), 456);
+}
 
 // -----------------------
 // ESlaveUpdate
index 703afa9e27ad284baeffbdde0603a9d92918ec4d..68fd7af2cc0ae4b6aeb6ee5a304791b041ea6b33 100644 (file)
@@ -123,6 +123,9 @@ TYPE(Capability)
 #include "mds/AnchorServer.h"
 TYPE(AnchorServer)
 
+#include "mds/events/ECommitted.h"
+TYPE(ECommitted)
+
 #ifdef WITH_RADOSGW
 
 #include "rgw/rgw_rados.h"