]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: rename watch/notify callback register functions
authorSage Weil <sage@redhat.com>
Mon, 11 Aug 2014 00:57:43 +0000 (17:57 -0700)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:18 +0000 (01:34 +0100)
Make it clear these are for watch OR notify, not just watch.  I was
confused.

Signed-off-by: Sage Weil <sage@redhat.com>
src/librados/IoCtxImpl.cc
src/librados/RadosClient.cc
src/librados/RadosClient.h

index 531b544b256ba7f0a774664aa5e464c4139e4de5..d766c40dac2fc1940580723d6c9991bdac4581bb 100644 (file)
@@ -1014,7 +1014,7 @@ int librados::IoCtxImpl::watch(const object_t& oid, uint64_t ver,
   lock->Lock();
 
   WatchContext *wc = new WatchContext(this, oid, ctx);
-  client->register_watcher(wc, cookie);
+  client->register_watch_notify_callback(wc, cookie);
   prepare_assert_ops(&wr);
   wr.watch(*cookie, ver, 1);
   bufferlist bl;
@@ -1033,7 +1033,7 @@ int librados::IoCtxImpl::watch(const object_t& oid, uint64_t ver,
 
   if (r < 0) {
     lock->Lock();
-    client->unregister_watcher(*cookie);
+    client->unregister_watch_notify_callback(*cookie);
     lock->Unlock();
   }
 
@@ -1067,7 +1067,7 @@ int librados::IoCtxImpl::unwatch(const object_t& oid, uint64_t cookie)
   version_t ver;
   lock->Lock();
 
-  client->unregister_watcher(cookie);
+  client->unregister_watch_notify_callback(cookie);
 
   ::ObjectOperation wr;
   prepare_assert_ops(&wr);
@@ -1104,7 +1104,7 @@ int librados::IoCtxImpl::notify(const object_t& oid, uint64_t ver, bufferlist& b
 
   lock->Lock();
   WatchContext *wc = new WatchContext(this, oid, ctx);
-  client->register_watcher(wc, &cookie);
+  client->register_watch_notify_callback(wc, &cookie);
   uint32_t prot_ver = 1;
   uint32_t timeout = notify_timeout;
   ::encode(prot_ver, inbl);
@@ -1128,7 +1128,7 @@ int librados::IoCtxImpl::notify(const object_t& oid, uint64_t ver, bufferlist& b
   mylock_all.Unlock();
 
   lock->Lock();
-  client->unregister_watcher(cookie);
+  client->unregister_watch_notify_callback(cookie);
   lock->Unlock();
 
   set_sync_op_version(objver);
index 25544a7aa5b9f2008256fbf3b9557c97be228fdc..583c16c1d9bb31982cf1337bf2641c53bdeb692b 100644 (file)
@@ -607,14 +607,16 @@ int librados::RadosClient::pool_delete_async(const char *name, PoolAsyncCompleti
   return r;
 }
 
-void librados::RadosClient::register_watcher(WatchContext *wc, uint64_t *cookie)
+void librados::RadosClient::register_watch_notify_callback(
+  WatchContext *wc,
+  uint64_t *cookie)
 {
   assert(lock.is_locked_by_me());
   wc->cookie = *cookie = ++max_watch_cookie;
   watchers[wc->cookie] = wc;
 }
 
-void librados::RadosClient::unregister_watcher(uint64_t cookie)
+void librados::RadosClient::unregister_watch_notify_callback(uint64_t cookie)
 {
   assert(lock.is_locked_by_me());
   map<uint64_t, WatchContext *>::iterator iter = watchers.find(cookie);
@@ -625,9 +627,9 @@ void librados::RadosClient::unregister_watcher(uint64_t cookie)
 
     watchers.erase(iter);
     lock.Unlock();
-    ldout(cct, 10) << "unregister_watcher, dropping reference, waiting ctx=" << (void *)ctx << dendl;
+    ldout(cct, 10) << __func__ << " dropping reference, waiting ctx=" << (void *)ctx << dendl;
     ctx->put_wait();
-    ldout(cct, 10) << "unregister_watcher, done ctx=" << (void *)ctx << dendl;
+    ldout(cct, 10) << __func__ << " done ctx=" << (void *)ctx << dendl;
     lock.Lock();
   }
 }
index 2056ae9fdd577e8ffc0498a22470972d0f919caa..1c870180b11d8924bf62903902575e4859dd2ae4 100755 (executable)
@@ -110,8 +110,9 @@ public:
   uint64_t max_watch_cookie;
   map<uint64_t, librados::WatchContext *> watchers;
 
-  void register_watcher(librados::WatchContext *wc, uint64_t *cookie);
-  void unregister_watcher(uint64_t cookie);
+  void register_watch_notify_callback(librados::WatchContext *wc,
+                                     uint64_t *cookie);
+  void unregister_watch_notify_callback(uint64_t cookie);
   void watch_notify(MWatchNotify *m);
   int mon_command(const vector<string>& cmd, const bufferlist &inbl,
                  bufferlist *outbl, string *outs);