#include "rgw_common.h"
#include "rgw_coroutine.h"
+#include "rgw_cr_rados.h"
#include "rgw_sync_module.h"
-// #include "rgw_sync.h"
#include "rgw_data_sync.h"
+#include "rgw_boost_asio_yield.h"
#define dout_subsys ceph_subsys_rgw
+class RGWLogStatRemoteObjCR : public RGWCoroutine {
+ RGWDataSyncEnv *sync_env;
+
+ RGWBucketInfo bucket_info;
+ rgw_obj_key key;
+
+ ceph::real_time mtime;
+ uint64_t size;
+ map<string, bufferlist> attrs;
+
+
+public:
+ RGWLogStatRemoteObjCR(RGWDataSyncEnv *_sync_env,
+ RGWBucketInfo& _bucket_info, rgw_obj_key& _key) : RGWCoroutine(_sync_env->cct),
+ sync_env(_sync_env),
+ bucket_info(_bucket_info), key(_key) {
+ }
+
+ ~RGWLogStatRemoteObjCR() {}
+
+ int operate() {
+ reenter(this) {
+ yield {
+ call(new RGWStatRemoteObjCR(sync_env->async_rados, sync_env->store,
+ sync_env->source_zone,
+ bucket_info, key, &mtime, &size, &attrs));
+ }
+ if (retcode < 0) {
+ ldout(sync_env->cct, 0) << "RGWStatRemoteObjCR() returned " << retcode << dendl;
+ return set_cr_error(retcode);
+ }
+ ldout(sync_env->cct, 0) << "stat of remote obj: z=" << sync_env->source_zone
+ << " b=" << bucket_info.bucket << " k=" << key << " size=" << size << " mtime=" << mtime
+ << " attrs=" << attrs << dendl;
+ return set_cr_done();
+ }
+ return 0;
+ }
+};
+
class RGWLogDataSyncModule : public RGWDataSyncModule {
string prefix;
public:
RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch) override {
ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: sync_object: b=" << bucket_info.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch << dendl;
- return NULL;
+ return new RGWLogStatRemoteObjCR(sync_env, bucket_info, key);
}
RGWCoroutine *remove_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime, bool versioned, uint64_t versioned_epoch) override {
ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: rm_object: b=" << bucket_info.bucket << " k=" << key << " mtime=" << mtime << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;