]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add ObjectReadOperation and IoCtx functions
authorDavid Zafman <david.zafman@inktank.com>
Thu, 21 Feb 2013 23:20:08 +0000 (15:20 -0800)
committerDavid Zafman <david.zafman@inktank.com>
Fri, 22 Feb 2013 05:50:02 +0000 (21:50 -0800)
Signed-off-by: David Zafman <david.zafman@inktank.com>
src/include/rados/librados.hpp
src/librados/librados.cc

index fa60237a3535ece4e2dbf1e87e42e417cca34885..fb585d09811e3320b18febde7536ab492d4249e6 100644 (file)
@@ -326,8 +326,15 @@ namespace librados
                               std::map<std::string, bufferlist> *map,
                               int *prval);
 
-  };
+    /**
+     * list_watchers: Get list watchers of object
+     *
+     * @param out_watchers [out] place returned values in out_watchers on completion
+     * @param prval [out] place error code in prval upon completion
+     */
+    void list_watchers(std::list<obj_watch_t> *out_watchers, int *prval);
 
+  };
 
   /* IoCtx : This is a context in which we can perform I/O.
    * It includes a Pool,
@@ -498,6 +505,7 @@ namespace librados
              librados::WatchCtx *ctx);
     int unwatch(const std::string& o, uint64_t handle);
     int notify(const std::string& o, uint64_t ver, bufferlist& bl);
+    int list_watchers(const std::string& o, std::list<obj_watch_t> *out_watchers);
     void set_notify_timeout(uint32_t timeout);
 
     // assert version for next sync operations
index 5a81a267f2b6e1189fd65ad46a2ad5fa5943f52b..0b7eaf9785056e9bb9ff63bebb2783d73207cfca 100644 (file)
@@ -211,6 +211,14 @@ void librados::ObjectOperation::omap_cmp(
   o->omap_cmp(assertions, prval);
 }
 
+void librados::ObjectReadOperation::list_watchers(
+  list<obj_watch_t> *out_watchers,
+  int *prval)
+{
+  ::ObjectOperation *o = (::ObjectOperation *)impl;
+  o->list_watchers(out_watchers, prval);
+}
+
 int librados::IoCtx::omap_get_vals(const std::string& oid,
                                    const std::string& start_after,
                                    const std::string& filter_prefix,
@@ -1018,6 +1026,20 @@ int librados::IoCtx::notify(const string& oid, uint64_t ver, bufferlist& bl)
   return io_ctx_impl->notify(obj, ver, bl);
 }
 
+int librados::IoCtx::list_watchers(const std::string& oid,
+                                   std::list<obj_watch_t> *out_watchers)
+{
+  ObjectReadOperation op;
+  int r;
+  op.list_watchers(out_watchers, &r);
+  bufferlist bl;
+  int ret = operate(oid, &op, &bl);
+  if (ret < 0)
+    return ret;
+
+  return r;
+}
+
 void librados::IoCtx::set_notify_timeout(uint32_t timeout)
 {
   io_ctx_impl->set_notify_timeout(timeout);