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";
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);
}
}
+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;
+}
// ------------------------