]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_sync_module_log.cc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rgw / rgw_sync_module_log.cc
CommitLineData
7c673cae
FG
1#include "rgw_common.h"
2#include "rgw_coroutine.h"
3#include "rgw_cr_rados.h"
4#include "rgw_sync_module.h"
5#include "rgw_data_sync.h"
6#include "rgw_boost_asio_yield.h"
7#include "rgw_sync_module_log.h"
8
9#define dout_subsys ceph_subsys_rgw
10
11class RGWLogStatRemoteObjCBCR : public RGWStatRemoteObjCBCR {
12public:
13 RGWLogStatRemoteObjCBCR(RGWDataSyncEnv *_sync_env,
14 RGWBucketInfo& _bucket_info, rgw_obj_key& _key) : RGWStatRemoteObjCBCR(_sync_env, _bucket_info, _key) {}
15 int operate() override {
16 ldout(sync_env->cct, 0) << "SYNC_LOG: stat of remote obj: z=" << sync_env->source_zone
17 << " b=" << bucket_info.bucket << " k=" << key << " size=" << size << " mtime=" << mtime
18 << " attrs=" << attrs << dendl;
19 return set_cr_done();
20 }
21
22};
23
24class RGWLogStatRemoteObjCR : public RGWCallStatRemoteObjCR {
25public:
26 RGWLogStatRemoteObjCR(RGWDataSyncEnv *_sync_env,
27 RGWBucketInfo& _bucket_info, rgw_obj_key& _key) : RGWCallStatRemoteObjCR(_sync_env, _bucket_info, _key) {
28 }
29
30 ~RGWLogStatRemoteObjCR() override {}
31
32 RGWStatRemoteObjCBCR *allocate_callback() override {
33 return new RGWLogStatRemoteObjCBCR(sync_env, bucket_info, key);
34 }
35};
36
37class RGWLogDataSyncModule : public RGWDataSyncModule {
38 string prefix;
39public:
40 RGWLogDataSyncModule(const string& _prefix) : prefix(_prefix) {}
41
42 RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch) override {
43 ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: sync_object: b=" << bucket_info.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch << dendl;
44 return new RGWLogStatRemoteObjCR(sync_env, bucket_info, key);
45 }
46 RGWCoroutine *remove_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime, bool versioned, uint64_t versioned_epoch) override {
47 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;
48 return NULL;
49 }
50 RGWCoroutine *create_delete_marker(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime,
51 rgw_bucket_entry_owner& owner, bool versioned, uint64_t versioned_epoch) override {
52 ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: create_delete_marker: b=" << bucket_info.bucket << " k=" << key << " mtime=" << mtime
53 << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;
54 return NULL;
55 }
56};
57
58class RGWLogSyncModuleInstance : public RGWSyncModuleInstance {
59 RGWLogDataSyncModule data_handler;
60public:
61 RGWLogSyncModuleInstance(const string& prefix) : data_handler(prefix) {}
62 RGWDataSyncModule *get_data_handler() override {
63 return &data_handler;
64 }
65};
66
67int RGWLogSyncModule::create_instance(CephContext *cct, map<string, string>& config, RGWSyncModuleInstanceRef *instance) {
68 string prefix;
69 auto i = config.find("prefix");
70 if (i != config.end()) {
71 prefix = i->second;
72 }
73 instance->reset(new RGWLogSyncModuleInstance(prefix));
74 return 0;
75}
76