X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Frgw%2Frgw_realm_watcher.h;fp=src%2Fceph%2Fsrc%2Frgw%2Frgw_realm_watcher.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=5c1240bbb4ffad0292d3ce62d0be4554be7a402a;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/rgw/rgw_realm_watcher.h b/src/ceph/src/rgw/rgw_realm_watcher.h deleted file mode 100644 index 5c1240b..0000000 --- a/src/ceph/src/rgw/rgw_realm_watcher.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#ifndef RGW_REALM_WATCHER_H -#define RGW_REALM_WATCHER_H - -#include "include/rados/librados.hpp" -#include "include/assert.h" -#include "common/Timer.h" -#include "common/Cond.h" - -class RGWRados; -class RGWRealm; - -enum class RGWRealmNotify { - Reload, - ZonesNeedPeriod, -}; -WRITE_RAW_ENCODER(RGWRealmNotify); - -/** - * RGWRealmWatcher establishes a watch on the current RGWRealm's control object, - * and forwards notifications to registered observers. - */ -class RGWRealmWatcher : public librados::WatchCtx2 { - public: - /** - * Watcher is an interface that allows the RGWRealmWatcher to pass - * notifications on to other interested objects. - */ - class Watcher { - public: - virtual ~Watcher() = default; - - virtual void handle_notify(RGWRealmNotify type, - bufferlist::iterator& p) = 0; - }; - - RGWRealmWatcher(CephContext* cct, RGWRealm& realm); - ~RGWRealmWatcher() override; - - /// register a watcher for the given notification type - void add_watcher(RGWRealmNotify type, Watcher& watcher); - - /// respond to realm notifications by calling the appropriate watcher - void handle_notify(uint64_t notify_id, uint64_t cookie, - uint64_t notifier_id, bufferlist& bl) override; - - /// reestablish the watch if it gets disconnected - void handle_error(uint64_t cookie, int err) override; - - private: - CephContext *const cct; - - /// keep a separate Rados client whose lifetime is independent of RGWRados - /// so that we don't miss notifications during realm reconfiguration - librados::Rados rados; - librados::IoCtx pool_ctx; - uint64_t watch_handle; - std::string watch_oid; - - int watch_start(RGWRealm& realm); - int watch_restart(); - void watch_stop(); - - std::map watchers; -}; - -#endif // RGW_REALM_WATCHER_H