ops.rbegin()->op.flags = flags;
}
+ /**
+ * This is a more limited form of C_Contexts, but that requires
+ * a ceph_context which we don't have here.
+ */
+ class C_TwoContexts : public Context {
+ Context *first;
+ Context *second;
+ public:
+ C_TwoContexts(Context *first, Context *second) : first(first),
+ second(second) {}
+ void finish(int r) {
+ first->complete(r);
+ second->complete(r);
+ }
+ };
+
+ /**
+ * Add a callback to run when this operation completes,
+ * after any other callbacks for it.
+ */
+ void add_handler(Context *extra) {
+ size_t last = out_handler.size() - 1;
+ Context *orig = out_handler[last];
+ if (orig) {
+ Context *wrapper = new C_TwoContexts(orig, extra);
+ out_handler[last] = wrapper;
+ } else {
+ out_handler[last] = extra;
+ }
+ }
+
OSDOp& add_op(int op) {
int s = ops.size();
ops.resize(s+1);