]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: move C_TwoContexts class to cc file 9250/head
authorMichal Jarzabek <stiopa@gmail.com>
Sat, 21 May 2016 14:46:18 +0000 (15:46 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Sat, 21 May 2016 14:48:18 +0000 (15:48 +0100)
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index c703488bd337c8bee42d7ec9eaf00068c6be8229..d51a4523b47435a0eafe529ba3ba2bff949adc16 100644 (file)
@@ -153,6 +153,40 @@ static const char *config_keys[] = {
   NULL
 };
 
+/**
+ * This is a more limited form of C_Contexts, but that requires
+ * a ceph_context which we don't have here.
+ */
+class ObjectOperation::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);
+    first = NULL;
+    second = NULL;
+  }
+
+  virtual ~C_TwoContexts() {
+    delete first;
+    delete second;
+  }
+};
+
+void ObjectOperation::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;
+  }
+}
+
 Objecter::OSDSession::unique_completion_lock Objecter::OSDSession::get_lock(
   object_t& oid)
 {
index 612b8fdf186fe42a1e0c4cda39280f600ba682a5..e12106bce63c2425e4bb1c32cc9e7d3117aa96bf 100644 (file)
@@ -86,43 +86,12 @@ struct ObjectOperation {
     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);
-      first = NULL;
-      second = NULL;
-    }
-
-    virtual ~C_TwoContexts() {
-      delete first;
-      delete second;
-    }
-  };
-
+  class C_TwoContexts;
   /**
    * 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;
-    }
-  }
+  void add_handler(Context *extra);
 
   OSDOp& add_op(int op) {
     int s = ops.size();