#include "common/errno.h"
#include "common/Formatter.h"
#include "common/Throttle.h"
+#include "common/Finisher.h"
#include "rgw_rados.h"
#include "rgw_cache.h"
class RGWWatcher : public librados::WatchCtx2 {
RGWRados *rados;
string oid;
+
+ class C_ReinitWatch : public Context {
+ RGWWatcher *watcher;
+ public:
+ C_ReinitWatch(RGWWatcher *_watcher) : watcher(_watcher) {}
+ void finish(int r) {
+ watcher->reinit();
+ }
+ };
public:
RGWWatcher(RGWRados *r, const string& o) : rados(r), oid(o) {}
void handle_notify(uint64_t notify_id,
lderr(rados->ctx()) << "RGWWatcher::handle_error cookie " << cookie
<< " err " << cpp_strerror(err) << dendl;
rados->set_cache_enabled(false);
+ rados->schedule_context(new C_ReinitWatch(this));
+ }
+
+ void reinit() {
rados->finalize_watch();
int ret = rados->init_watch();
if (ret < 0) {
void RGWRados::finalize()
{
+ finisher->stop();
+ delete finisher;
if (need_watch_notify()) {
finalize_watch();
}
}
}
+ finisher = new Finisher(cct);
+ finisher->start();
+
if (need_watch_notify()) {
ret = init_watch();
if (ret < 0) {
delete[] watchers;
}
+void RGWRados::schedule_context(Context *c) {
+ finisher->queue(c);
+}
+
int RGWRados::list_raw_prefixed_objs(string pool_name, const string& prefix, list<string>& result)
{
rgw_bucket pool(pool_name.c_str());
void invalidate(rgw_obj& obj);
};
+class Finisher;
+
class RGWRados
{
friend class RGWGC;
RGWQuotaHandler *quota_handler;
+ Finisher *finisher;
+
public:
RGWRados() : lock("rados_timer_lock"), timer(NULL),
gc(NULL), use_gc_thread(false), quota_threads(false),
cct(NULL), rados(NULL),
pools_initialized(false),
quota_handler(NULL),
+ finisher(NULL),
rest_master_conn(NULL),
meta_mgr(NULL), data_log(NULL) {}
virtual int initialize();
virtual void finalize();
+ void schedule_context(Context *c);
+
/** set up a bucket listing. handle is filled in. */
virtual int list_buckets_init(RGWAccessHandle *handle);
/**