static void generate_test_instances(list<RGWCacheNotifyInfo*>& o);
};
WRITE_CLASS_ENCODER(RGWCacheNotifyInfo)
+inline std::ostream& operator <<(std::ostream& m, const RGWCacheNotifyInfo& cni) {
+ return m << "[op: " << cni.op << ", obj: " << cni.obj
+ << ", ofs" << cni.ofs << ", ns" << cni.ns << "]";
+}
+
class RGWChainedCache {
public:
#include "include/Context.h"
#include "common/errno.h"
+#include "rgw/rgw_cache.h"
#include "svc_notify.h"
#include "svc_finisher.h"
#include "svc_zone.h"
watcher->reinit();
}
};
+
public:
RGWWatcher(CephContext *_cct, RGWSI_Notify *s, int i, RGWSI_RADOS::Obj& o) : cct(_cct), svc(s), index(i), obj(o), watch_handle(0) {}
void handle_notify(uint64_t notify_id,
}
}
-int RGWSI_Notify::distribute(const string& key, bufferlist& bl,
- optional_yield y)
+int RGWSI_Notify::distribute(const string& key, const RGWCacheNotifyInfo& cni,
+ optional_yield y)
{
/* The RGW uses the control pool to store the watch notify objects.
The precedence in RGWSI_Notify::do_start is to call to zone_svc->start and later to init_watch().
RGWSI_RADOS::Obj notify_obj = pick_control_obj(key);
ldout(cct, 10) << "distributing notification oid=" << notify_obj.get_ref().obj
- << " bl.length()=" << bl.length() << dendl;
- return robust_notify(notify_obj, bl, y);
+ << " cni=" << cni << dendl;
+ return robust_notify(notify_obj, cni, y);
}
return 0;
}
-int RGWSI_Notify::robust_notify(RGWSI_RADOS::Obj& notify_obj, bufferlist& bl,
+int RGWSI_Notify::robust_notify(RGWSI_RADOS::Obj& notify_obj,
+ const RGWCacheNotifyInfo& cni,
optional_yield y)
{
// The reply of every machine that acks goes in here.
boost::container::flat_set<std::pair<uint64_t, uint64_t>> acks;
- bufferlist rbl;
+ bufferlist bl, rbl;
+ encode(cni, bl);
// First, try to send, without being fancy about it.
auto r = notify_obj.notify(bl, 0, &rbl, y);
class RGWWatcher;
class RGWSI_Notify_ShutdownCB;
+struct RGWCacheNotifyInfo;
class RGWSI_Notify : public RGWServiceInstance
{
void _set_enabled(bool status);
void set_enabled(bool status);
- int robust_notify(RGWSI_RADOS::Obj& notify_obj, bufferlist& bl,
- optional_yield y);
+ int robust_notify(RGWSI_RADOS::Obj& notify_obj,
+ const RGWCacheNotifyInfo& bl, optional_yield y);
void schedule_context(Context *c);
public:
virtual void set_enabled(bool status) = 0;
};
- int distribute(const string& key, bufferlist& bl, optional_yield y);
+ int distribute(const string& key, const RGWCacheNotifyInfo& bl,
+ optional_yield y);
void register_watch_cb(CB *cb);
};