]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Rebase: MDS: Add an MDSContinuation for ease of use
authorGreg Farnum <gfarnum@redhat.com>
Wed, 5 Nov 2014 22:23:32 +0000 (14:23 -0800)
committerGreg Farnum <gfarnum@redhat.com>
Fri, 7 Nov 2014 19:48:44 +0000 (11:48 -0800)
Unlike the regular Continuation, this one works in terms of an MDRequest
and has wrappers to provide Context callbacks that are either
internal MDS or IO appropriate.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/mds/MDSContinuation.h [new file with mode: 0644]
src/mds/Makefile.am

diff --git a/src/mds/MDSContinuation.h b/src/mds/MDSContinuation.h
new file mode 100644 (file)
index 0000000..82d178f
--- /dev/null
@@ -0,0 +1,35 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2014 Red Hat
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation.  See file COPYING.
+ *
+ */
+#include "common/Continuation.h"
+#include "mds/Mutation.h"
+#include "mds/Server.h"
+class MDSContinuation : public Continuation {
+  MDRequestRef mdr;
+  Server *server;
+public:
+  MDSContinuation(MDRequestRef& mdrequest, Server *s) :
+    Continuation(NULL), mdr(mdrequest), server(s) {}
+protected:
+  void _done() {
+    server->respond_to_request(mdr, get_rval());
+  }
+  MDSInternalContextBase *get_internal_callback(int stage) {
+    return new MDSInternalContextWrapper(server->mds, get_callback(stage));
+  }
+  MDSIOContextBase *get_io_callback(int stage) {
+    return new MDSIOContextWrapper(server->mds, get_callback(stage));
+  }
+};
index 71f76d5c010a91349734316585e7e5fbf746414e..a0dadc9aa5ac2dcb12c21b4cd8d1afdfa8d68fac 100644 (file)
@@ -69,7 +69,8 @@ noinst_HEADERS += \
        mds/inode_backtrace.h \
        mds/mds_table_types.h \
        mds/mdstypes.h \
-       mds/snap.h
+       mds/snap.h \
+       mds/MDSContinuation.h
 
 noinst_HEADERS += \
        mds/events/ECommitted.h \