]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: do not overload C++ API methods with new signatures
authorSage Weil <sage@redhat.com>
Fri, 12 Dec 2014 21:18:35 +0000 (13:18 -0800)
committerSage Weil <sage@redhat.com>
Fri, 12 Dec 2014 21:18:35 +0000 (13:18 -0800)
Bah!  C++ sucks for libraries.

Signed-off-by: Sage Weil <sage@redhat.com>
src/include/rados/librados.hpp
src/librados/librados.cc
src/rgw/rgw_rados.cc
src/test/librados/watch_notify.cc
src/test/osd/RadosModel.h
src/tools/rados/rados.cc

index 967308372a0b1c0df44d6529943e9e14d8ed6e98..84f40225e1fd03398d35e5861d782529549423dc 100644 (file)
@@ -924,9 +924,9 @@ namespace librados
                    bufferlist *pbl);
 
     // watch/notify
-    int watch(const std::string& o, uint64_t *handle,
-             librados::WatchCtx2 *ctx);
-    int unwatch(uint64_t handle);
+    int watch2(const std::string& o, uint64_t *handle,
+              librados::WatchCtx2 *ctx);
+    int unwatch2(uint64_t handle);
     /**
      * Send a notify event ot watchers
      *
@@ -948,10 +948,10 @@ namespace librados
      *
      *
      */
-    int notify(const std::string& o,   ///< object
-              bufferlist& bl,         ///< optional broadcast payload
-              uint64_t timeout_ms,    ///< timeout (in ms)
-              bufferlist *pbl);       ///< reply buffer
+    int notify2(const std::string& o,   ///< object
+               bufferlist& bl,         ///< optional broadcast payload
+               uint64_t timeout_ms,    ///< timeout (in ms)
+               bufferlist *pbl);       ///< reply buffer
     int list_watchers(const std::string& o, std::list<obj_watch_t> *out_watchers);
     int list_snaps(const std::string& o, snap_set_t *out_snaps);
     void set_notify_timeout(uint32_t timeout);
index 3c45d1f70565bc410265a0a4a6c4f88dcf35e0ea..19b80474f87467e9d094b33f5300c5e66dcda615 100644 (file)
@@ -1666,8 +1666,8 @@ int librados::IoCtx::watch(const string& oid, uint64_t ver, uint64_t *cookie,
   return io_ctx_impl->watch(obj, cookie, ctx, NULL);
 }
 
-int librados::IoCtx::watch(const string& oid, uint64_t *cookie,
-                          librados::WatchCtx2 *ctx2)
+int librados::IoCtx::watch2(const string& oid, uint64_t *cookie,
+                           librados::WatchCtx2 *ctx2)
 {
   object_t obj(oid);
   return io_ctx_impl->watch(obj, cookie, NULL, ctx2);
@@ -1679,7 +1679,7 @@ int librados::IoCtx::unwatch(const string& oid, uint64_t handle)
   return io_ctx_impl->unwatch(handle);
 }
 
-int librados::IoCtx::unwatch(uint64_t handle)
+int librados::IoCtx::unwatch2(uint64_t handle)
 {
   return io_ctx_impl->unwatch(handle);
 }
@@ -1695,8 +1695,8 @@ int librados::IoCtx::notify(const string& oid, uint64_t ver, bufferlist& bl)
   return io_ctx_impl->notify(obj, bl, 0, NULL, NULL, NULL);
 }
 
-int librados::IoCtx::notify(const string& oid, bufferlist& bl,
-                           uint64_t timeout_ms, bufferlist *preplybl)
+int librados::IoCtx::notify2(const string& oid, bufferlist& bl,
+                            uint64_t timeout_ms, bufferlist *preplybl)
 {
   object_t obj(oid);
   return io_ctx_impl->notify(obj, bl, timeout_ms, preplybl, NULL, NULL);
index dd251b82c6959e23cc2ba2b5d7bbf52930164c63..5a6c1f56e2f1d950958300e578c2778eaf2fd9c9 100644 (file)
@@ -1473,7 +1473,7 @@ void RGWRados::finalize_watch()
     if (notify_oid.empty())
       continue;
     uint64_t watch_handle = watch_handles[i];
-    control_pool_ctx.unwatch(watch_handle);
+    control_pool_ctx.unwatch2(watch_handle);
 
     RGWWatcher *watcher = watchers[i];
     delete watcher;
@@ -1608,7 +1608,7 @@ int RGWRados::init_watch()
     RGWWatcher *watcher = new RGWWatcher(this);
     watchers[i] = watcher;
 
-    r = control_pool_ctx.watch(notify_oid, &watch_handles[i], watcher);
+    r = control_pool_ctx.watch2(notify_oid, &watch_handles[i], watcher);
     if (r < 0)
       return r;
   }
@@ -5814,7 +5814,7 @@ int RGWRados::distribute(const string& key, bufferlist& bl)
   pick_control_oid(key, notify_oid);
 
   ldout(cct, 10) << "distributing notification oid=" << notify_oid << " bl.length()=" << bl.length() << dendl;
-  int r = control_pool_ctx.notify(notify_oid, bl, 0, NULL);
+  int r = control_pool_ctx.notify2(notify_oid, bl, 0, NULL);
   return r;
 }
 
index c0f9c187b5376ed2b0d1a9de9c03aa61fa022f0b..857e315a43f56ff1575798b98839c96d2a3046d9 100644 (file)
@@ -386,13 +386,13 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify2) {
   ASSERT_EQ(0, ioctx.write(notify_oid, bl1, sizeof(buf), 0));
   uint64_t handle;
   WatchNotifyTestCtx2 ctx;
-  ASSERT_EQ(0, ioctx.watch(notify_oid, &handle, &ctx));
+  ASSERT_EQ(0, ioctx.watch2(notify_oid, &handle, &ctx));
   ASSERT_GT(ioctx.watch_check(handle), 0);
   std::list<obj_watch_t> watches;
   ASSERT_EQ(0, ioctx.list_watchers(notify_oid, &watches));
   ASSERT_EQ(watches.size(), 1u);
   bufferlist bl2, bl_reply;
-  ASSERT_EQ(0, ioctx.notify(notify_oid, bl2, 0, &bl_reply));
+  ASSERT_EQ(0, ioctx.notify2(notify_oid, bl2, 0, &bl_reply));
   bufferlist::iterator p = bl_reply.begin();
   std::map<std::pair<uint64_t,uint64_t>,bufferlist> reply_map;
   std::set<std::pair<uint64_t,uint64_t> > missed_map;
@@ -405,7 +405,7 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify2) {
   ASSERT_EQ(0, strncmp("reply", reply_map.begin()->second.c_str(), 5));
   ASSERT_EQ(0u, missed_map.size());
   ASSERT_GT(ioctx.watch_check(handle), 0);
-  ioctx.unwatch(handle);
+  ioctx.unwatch2(handle);
 }
 
 // --
@@ -514,17 +514,17 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify2Timeout) {
   ASSERT_EQ(0, ioctx.write(notify_oid, bl1, sizeof(buf), 0));
   uint64_t handle;
   WatchNotifyTestCtx2 ctx;
-  ASSERT_EQ(0, ioctx.watch(notify_oid, &handle, &ctx));
+  ASSERT_EQ(0, ioctx.watch2(notify_oid, &handle, &ctx));
   ASSERT_GT(ioctx.watch_check(handle), 0);
   std::list<obj_watch_t> watches;
   ASSERT_EQ(0, ioctx.list_watchers(notify_oid, &watches));
   ASSERT_EQ(watches.size(), 1u);
   ASSERT_EQ(0u, notify_cookies.size());
   bufferlist bl2, bl_reply;
-  ASSERT_EQ(-ETIMEDOUT, ioctx.notify(notify_oid, bl2, 1000 /* 1s */,
-                                    &bl_reply));
+  ASSERT_EQ(-ETIMEDOUT, ioctx.notify2(notify_oid, bl2, 1000 /* 1s */,
+                                     &bl_reply));
   ASSERT_GT(ioctx.watch_check(handle), 0);
-  ioctx.unwatch(handle);
+  ioctx.unwatch2(handle);
 }
 
 // --
index 8b2fc890963f0dc7d5ba2b9674d5b543b2439171..5a026b29d104f7356dad7c79ff62db51b5da647d 100644 (file)
@@ -995,7 +995,7 @@ public:
       std::cerr << num << ":  started" << std::endl;
       bufferlist bl;
       context->io_ctx.set_notify_timeout(600);
-      int r = context->io_ctx.notify(context->prefix+oid, bl, 0, NULL);
+      int r = context->io_ctx.notify2(context->prefix+oid, bl, 0, NULL);
       if (r < 0) {
        std::cerr << "r is " << r << std::endl;
        assert(0);
@@ -1315,11 +1315,11 @@ public:
        ctx = context->watch(oid);
       }
 
-      r = context->io_ctx.watch(context->prefix+oid,
-                               &ctx->get_handle(),
-                               ctx);
+      r = context->io_ctx.watch2(context->prefix+oid,
+                                &ctx->get_handle(),
+                                ctx);
     } else {
-      r = context->io_ctx.unwatch(ctx->get_handle());
+      r = context->io_ctx.unwatch2(ctx->get_handle());
       {
        Mutex::Locker l(context->state_lock);
        context->unwatch(oid);
index b75187a7895437b528dc55fa173f19f4d2f02454..04f3d0a883158f96fa9c878ad0f80e7fb73e225b 100644 (file)
@@ -2356,7 +2356,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     string oid(nargs[1]);
     RadosWatchCtx ctx(io_ctx, oid.c_str());
     uint64_t cookie;
-    ret = io_ctx.watch(oid, &cookie, &ctx);
+    ret = io_ctx.watch2(oid, &cookie, &ctx);
     if (ret != 0)
       cerr << "error calling watch: " << ret << std::endl;
     else {
@@ -2371,7 +2371,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     string msg(nargs[2]);
     bufferlist bl, replybl;
     ::encode(msg, bl);
-    ret = io_ctx.notify(oid, bl, 10000, &replybl);
+    ret = io_ctx.notify2(oid, bl, 10000, &replybl);
     if (ret != 0)
       cerr << "error calling notify: " << ret << std::endl;
     if (replybl.length()) {