#include "include/utime.h"
#include "include/util.h"
#include "common/Formatter.h"
+#include "include/Context.h"
+#include "mon/MonOpRequest.h"
#define PAXOS_PGMAP 0 // before osd, for pg kick to behave
#define PAXOS_MDSMAP 1
/// for information like os, kernel, hostname, memory info, cpu model.
typedef map<string, string> Metadata;
+struct C_MonOp : public Context
+{
+ MonOpRequestRef op;
+
+ C_MonOp(MonOpRequestRef o) :
+ op(o) { }
+
+ void finish(int r) {
+ if (op && r == -ECANCELED) {
+ op->mark_event("callback canceled");
+ } else if (op && r == -EAGAIN) {
+ op->mark_event("callback retry");
+ } else if (op && r == 0) {
+ op->mark_event("callback finished");
+ }
+ _finish(r);
+ }
+
+ void mark_op_event(const string &event) {
+ if (op)
+ op->mark_event(event);
+ }
+
+ virtual void _finish(int r) = 0;
+};
+
#endif