]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: implement C_MonOp on op-related callback contexts
authorJoao Eduardo Luis <joao@suse.de>
Mon, 8 Jun 2015 14:04:37 +0000 (15:04 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Thu, 16 Jul 2015 17:06:07 +0000 (18:06 +0100)
These contexts deal with MonOpRequests, and we need to track their life
cycle; use C_MonOp to mark events when the callbacks are woken up for some
reason.

Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/mon/Monitor.h

index ab7876f1fb420334a9df2a9a07fa62f527e8c940..52b7c5e674958126dec83444e05013960b1c429d 100644 (file)
@@ -815,18 +815,18 @@ public:
                    const vector<string>& com);
 
 public:
-  struct C_Command : public Context {
+  struct C_Command : public C_MonOp {
     Monitor *mon;
-    MonOpRequestRef op;
     int rc;
     string rs;
     bufferlist rdata;
     version_t version;
     C_Command(Monitor *_mm, MonOpRequestRef _op, int r, string s, version_t v) :
-      mon(_mm), op(_op), rc(r), rs(s), version(v){}
+      C_MonOp(_op), mon(_mm), rc(r), rs(s), version(v){}
     C_Command(Monitor *_mm, MonOpRequestRef _op, int r, string s, bufferlist rd, version_t v) :
-      mon(_mm), op(_op), rc(r), rs(s), rdata(rd), version(v){}
-    void finish(int r) {
+      C_MonOp(_op), mon(_mm), rc(r), rs(s), rdata(rd), version(v){}
+
+    virtual void _finish(int r) {
       MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
       if (r >= 0) {
         ostringstream ss;
@@ -858,12 +858,13 @@ public:
   };
 
  private:
-  class C_RetryMessage : public Context {
+  class C_RetryMessage : public C_MonOp {
     Monitor *mon;
-    MonOpRequestRef op;
   public:
-    C_RetryMessage(Monitor *m, MonOpRequestRef o) : mon(m), op(o) {}
-    void finish(int r) {
+    C_RetryMessage(Monitor *m, MonOpRequestRef op) :
+      C_MonOp(op), mon(m) { }
+
+    virtual void _finish(int r) {
       if (r == -EAGAIN || r >= 0)
         mon->dispatch_op(op);
       else if (r == -ECANCELED)