]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_sync_module_log.cc
import ceph pacific 16.2.5
[ceph.git] / ceph / src / rgw / rgw_sync_module_log.cc
CommitLineData
11fdf7f2 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
11fdf7f2 3
7c673cae
FG
4#include "rgw_common.h"
5#include "rgw_coroutine.h"
6#include "rgw_cr_rados.h"
7#include "rgw_sync_module.h"
8#include "rgw_data_sync.h"
7c673cae
FG
9#include "rgw_sync_module_log.h"
10
11#define dout_subsys ceph_subsys_rgw
12
13class RGWLogStatRemoteObjCBCR : public RGWStatRemoteObjCBCR {
14public:
9f95a23c
TL
15 RGWLogStatRemoteObjCBCR(RGWDataSyncCtx *_sc,
16 rgw_bucket& _src_bucket, rgw_obj_key& _key) : RGWStatRemoteObjCBCR(_sc, _src_bucket, _key) {}
b3b6e05e
TL
17 int operate(const DoutPrefixProvider *dpp) override {
18 ldpp_dout(dpp, 0) << "SYNC_LOG: stat of remote obj: z=" << sc->source_zone
9f95a23c 19 << " b=" << src_bucket << " k=" << key << " size=" << size << " mtime=" << mtime
7c673cae
FG
20 << " attrs=" << attrs << dendl;
21 return set_cr_done();
22 }
23
24};
25
26class RGWLogStatRemoteObjCR : public RGWCallStatRemoteObjCR {
27public:
9f95a23c
TL
28 RGWLogStatRemoteObjCR(RGWDataSyncCtx *_sc,
29 rgw_bucket& _src_bucket, rgw_obj_key& _key) : RGWCallStatRemoteObjCR(_sc, _src_bucket, _key) {
7c673cae
FG
30 }
31
32 ~RGWLogStatRemoteObjCR() override {}
33
34 RGWStatRemoteObjCBCR *allocate_callback() override {
9f95a23c 35 return new RGWLogStatRemoteObjCBCR(sc, src_bucket, key);
7c673cae
FG
36 }
37};
38
39class RGWLogDataSyncModule : public RGWDataSyncModule {
40 string prefix;
41public:
11fdf7f2 42 explicit RGWLogDataSyncModule(const string& _prefix) : prefix(_prefix) {}
7c673cae 43
9f95a23c
TL
44 RGWCoroutine *sync_object(RGWDataSyncCtx *sc, rgw_bucket_sync_pipe& sync_pipe, rgw_obj_key& key, std::optional<uint64_t> versioned_epoch, rgw_zone_set *zones_trace) override {
45 ldout(sc->cct, 0) << prefix << ": SYNC_LOG: sync_object: b=" << sync_pipe.info.source_bs.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch.value_or(0) << dendl;
46 return new RGWLogStatRemoteObjCR(sc, sync_pipe.info.source_bs.bucket, key);
7c673cae 47 }
9f95a23c
TL
48 RGWCoroutine *remove_object(RGWDataSyncCtx *sc, rgw_bucket_sync_pipe& sync_pipe, rgw_obj_key& key, real_time& mtime, bool versioned, uint64_t versioned_epoch, rgw_zone_set *zones_trace) override {
49 ldout(sc->cct, 0) << prefix << ": SYNC_LOG: rm_object: b=" << sync_pipe.info.source_bs.bucket << " k=" << key << " mtime=" << mtime << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;
7c673cae
FG
50 return NULL;
51 }
9f95a23c 52 RGWCoroutine *create_delete_marker(RGWDataSyncCtx *sc, rgw_bucket_sync_pipe& sync_pipe, rgw_obj_key& key, real_time& mtime,
31f18b77 53 rgw_bucket_entry_owner& owner, bool versioned, uint64_t versioned_epoch, rgw_zone_set *zones_trace) override {
9f95a23c 54 ldout(sc->cct, 0) << prefix << ": SYNC_LOG: create_delete_marker: b=" << sync_pipe.info.source_bs.bucket << " k=" << key << " mtime=" << mtime
7c673cae
FG
55 << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;
56 return NULL;
57 }
58};
59
60class RGWLogSyncModuleInstance : public RGWSyncModuleInstance {
61 RGWLogDataSyncModule data_handler;
62public:
11fdf7f2 63 explicit RGWLogSyncModuleInstance(const string& prefix) : data_handler(prefix) {}
7c673cae
FG
64 RGWDataSyncModule *get_data_handler() override {
65 return &data_handler;
66 }
67};
68
11fdf7f2
TL
69int RGWLogSyncModule::create_instance(CephContext *cct, const JSONFormattable& config, RGWSyncModuleInstanceRef *instance) {
70 string prefix = config["prefix"];
7c673cae
FG
71 instance->reset(new RGWLogSyncModuleInstance(prefix));
72 return 0;
73}
74