]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: add async exec
authorYehuda Sadeh <yehuda@hq.newdream.net>
Sat, 24 Sep 2011 06:13:08 +0000 (23:13 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Sat, 24 Sep 2011 06:13:08 +0000 (23:13 -0700)
src/include/rados/librados.hpp
src/librados.cc

index c5c448a470fd8ce7841d0e04d728dc00a2b66a8c..fde4dd3a0413cc99346d2abba810444776bd09b6 100644 (file)
@@ -298,6 +298,9 @@ namespace librados
     
     int aio_flush();
 
+    int aio_exec(const std::string& oid, AioCompletion *c, const char *cls, const char *method,
+                bufferlist& inbl, bufferlist *outbl);
+
     // compound object operations
     int operate(const std::string& oid, ObjectWriteOperation *op);
     int operate(const std::string& oid, ObjectReadOperation *op, bufferlist *pbl);
index 14fa2b1fb01acb662275c9475e906851a365e0fc..dd34052e919e0fc69f3d666ce5fffede166efff5 100644 (file)
@@ -731,6 +731,8 @@ public:
                 const bufferlist& bl, size_t len);
   int aio_write_full(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
                     const bufferlist& bl);
+  int aio_exec(IoCtxImpl& io, const object_t& oid, AioCompletionImpl *c,
+               const char *cls, const char *method, bufferlist& inbl, bufferlist *outbl);
 
   struct C_PoolAsync_Safe : public Context {
     PoolAsyncCompletionImpl *c;
@@ -2106,6 +2108,21 @@ int librados::RadosClient::exec(IoCtxImpl& io, const object_t& oid,
   return r;
 }
 
+int librados::RadosClient::aio_exec(IoCtxImpl& io, const object_t& oid, AioCompletionImpl *c,
+                               const char *cls, const char *method,
+                               bufferlist& inbl, bufferlist *outbl)
+{
+  Context *onack = new C_aio_Ack(c);
+
+  Mutex::Locker l(lock);
+  ::ObjectOperation rd;
+  prepare_assert_ops(&io, &rd);
+  rd.call(cls, method, inbl);
+  objecter->read(oid, io.oloc, rd, io.snap_seq, outbl, 0, onack, &c->objver);
+
+  return 0;
+}
+
 int librados::RadosClient::read(IoCtxImpl& io, const object_t& oid,
                                bufferlist& bl, size_t len, uint64_t off)
 {
@@ -3008,6 +3025,13 @@ int librados::IoCtx::aio_read(const std::string& oid, librados::AioCompletion *c
   return io_ctx_impl->client->aio_read(*io_ctx_impl, oid, c->pc, pbl, len, off);
 }
 
+int librados::IoCtx::aio_exec(const std::string& oid, librados::AioCompletion *c, const char *cls, const char *method,
+                         bufferlist& inbl, bufferlist *outbl)
+{
+  object_t obj(oid);
+  return io_ctx_impl->client->aio_exec(*io_ctx_impl, obj, c->pc, cls, method, inbl, outbl);
+}
+
 int librados::IoCtx::aio_sparse_read(const std::string& oid, librados::AioCompletion *c,
                                     std::map<uint64_t,uint64_t> *m, bufferlist *data_bl,
                                     size_t len, uint64_t off)