]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "rgw: switch to new watch/notify API"
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 9 Jan 2015 22:02:04 +0000 (14:02 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 9 Jan 2015 22:18:32 +0000 (14:18 -0800)
This reverts commit dc67cd69604ec4e4df846b818ec739dc7b09a537.

Conflicts:
src/rgw/rgw_rados.cc

src/rgw/rgw_cache.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index f2baaea52435b29b54961bf46cd6c4d6c5d3e100..8b1bc93bfb029e013d4ba9a401878798372b8464 100644 (file)
@@ -201,10 +201,7 @@ class RGWCache  : public T
   }
 
   int distribute_cache(const string& normal_name, rgw_obj& obj, ObjectCacheInfo& obj_info, int op);
-  int watch_cb(uint64_t notify_id,
-              uint64_t cookie,
-              uint64_t notifier_id,
-              bufferlist& bl);
+  int watch_cb(int opcode, uint64_t ver, bufferlist& bl);
 public:
   RGWCache() {}
 
@@ -560,10 +557,7 @@ int RGWCache<T>::distribute_cache(const string& normal_name, rgw_obj& obj, Objec
 }
 
 template <class T>
-int RGWCache<T>::watch_cb(uint64_t notify_id,
-                         uint64_t cookie,
-                         uint64_t notifier_id,
-                         bufferlist& bl)
+int RGWCache<T>::watch_cb(int opcode, uint64_t ver, bufferlist& bl)
 {
   RGWCacheNotifyInfo info;
 
index dbc2bc8e5f2914740a4d80585a3fc2a1e253af12..df9191ea15d1c0f7dfdaa74ebdf978da6813b2dd 100644 (file)
@@ -1215,23 +1215,13 @@ int RGWPutObjProcessor_Atomic::do_complete(string& etag, time_t *mtime, time_t s
   return r;
 }
 
-class RGWWatcher : public librados::WatchCtx2 {
+class RGWWatcher : public librados::WatchCtx {
   RGWRados *rados;
 public:
   RGWWatcher(RGWRados *r) : rados(r) {}
-  void handle_notify(uint64_t notify_id,
-                    uint64_t cookie,
-                    uint64_t notifier_id,
-                    bufferlist& bl) {
-    ldout(rados->ctx(), 10) << "RGWWatcher::handle_notify() "
-                           << " notify_id " << notify_id
-                           << " cookie " << cookie
-                           << " notifier " << notifier_id
-                           << " bl.length()=" << bl.length() << dendl;
-    rados->watch_cb(notify_id, cookie, notifier_id, bl);
-  }
-  void handle_error(uint64_t cookie, int err) {
-    // FIXME
+  void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) {
+    ldout(rados->ctx(), 10) << "RGWWatcher::notify() opcode=" << (int)opcode << " ver=" << ver << " bl.length()=" << bl.length() << dendl;
+    rados->watch_cb(opcode, ver, bl);
   }
 };
 
@@ -1482,7 +1472,7 @@ void RGWRados::finalize_watch()
     if (notify_oid.empty())
       continue;
     uint64_t watch_handle = watch_handles[i];
-    control_pool_ctx.unwatch2(watch_handle);
+    control_pool_ctx.unwatch(notify_oid, watch_handle);
 
     RGWWatcher *watcher = watchers[i];
     delete watcher;
@@ -1617,7 +1607,7 @@ int RGWRados::init_watch()
     RGWWatcher *watcher = new RGWWatcher(this);
     watchers[i] = watcher;
 
-    r = control_pool_ctx.watch2(notify_oid, &watch_handles[i], watcher);
+    r = control_pool_ctx.watch(notify_oid, 0, &watch_handles[i], watcher);
     if (r < 0)
       return r;
   }
@@ -5890,7 +5880,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.notify2(notify_oid, bl, 0, NULL);
+  int r = control_pool_ctx.notify(notify_oid, 0, bl);
   return r;
 }
 
index 838e9422775f4bb9100b87c8aa69dca609c7b90a..d397a1f15e66223a9c886701e54584ae4508f519 100644 (file)
@@ -1783,10 +1783,7 @@ public:
   virtual int init_watch();
   virtual void finalize_watch();
   virtual int distribute(const string& key, bufferlist& bl);
-  virtual int watch_cb(uint64_t notify_id,
-                      uint64_t cookie,
-                      uint64_t notifier_id,
-                      bufferlist& bl) { return 0; }
+  virtual int watch_cb(int opcode, uint64_t ver, bufferlist& bl) { return 0; }
   void pick_control_oid(const string& key, string& notify_oid);
 
   void *create_context(void *user_ctx) {