]>
Commit | Line | Data |
---|---|---|
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" | |
11fdf7f2 | 9 | #include "rgw_bucket.h" |
7c673cae FG |
10 | |
11 | #include "rgw_sync_module_log.h" | |
12 | #include "rgw_sync_module_es.h" | |
11fdf7f2 TL |
13 | #include "rgw_sync_module_aws.h" |
14 | #include "rgw_sync_module_pubsub.h" | |
7c673cae | 15 | |
31f18b77 FG |
16 | #include <boost/asio/yield.hpp> |
17 | ||
7c673cae FG |
18 | #define dout_subsys ceph_subsys_rgw |
19 | ||
11fdf7f2 TL |
20 | RGWMetadataHandler *RGWSyncModuleInstance::alloc_bucket_meta_handler() |
21 | { | |
22 | return RGWBucketMetaHandlerAllocator::alloc(); | |
23 | } | |
24 | ||
9f95a23c | 25 | RGWBucketInstanceMetadataHandlerBase *RGWSyncModuleInstance::alloc_bucket_instance_meta_handler() |
11fdf7f2 TL |
26 | { |
27 | return RGWBucketInstanceMetaHandlerAllocator::alloc(); | |
28 | } | |
29 | ||
9f95a23c TL |
30 | RGWStatRemoteObjCBCR::RGWStatRemoteObjCBCR(RGWDataSyncCtx *_sc, |
31 | rgw_bucket& _src_bucket, rgw_obj_key& _key) : RGWCoroutine(_sc->cct), | |
32 | sc(_sc), sync_env(_sc->env), | |
33 | src_bucket(_src_bucket), key(_key) { | |
7c673cae FG |
34 | } |
35 | ||
9f95a23c TL |
36 | RGWCallStatRemoteObjCR::RGWCallStatRemoteObjCR(RGWDataSyncCtx *_sc, |
37 | rgw_bucket& _src_bucket, rgw_obj_key& _key) : RGWCoroutine(_sc->cct), | |
38 | sc(_sc), sync_env(_sc->env), | |
39 | src_bucket(_src_bucket), key(_key) { | |
7c673cae FG |
40 | } |
41 | ||
42 | int RGWCallStatRemoteObjCR::operate() { | |
43 | reenter(this) { | |
44 | yield { | |
45 | call(new RGWStatRemoteObjCR(sync_env->async_rados, sync_env->store, | |
9f95a23c TL |
46 | sc->source_zone, |
47 | src_bucket, key, &mtime, &size, &etag, &attrs, &headers)); | |
7c673cae FG |
48 | } |
49 | if (retcode < 0) { | |
11fdf7f2 | 50 | ldout(sync_env->cct, 10) << "RGWStatRemoteObjCR() returned " << retcode << dendl; |
7c673cae FG |
51 | return set_cr_error(retcode); |
52 | } | |
9f95a23c TL |
53 | ldout(sync_env->cct, 20) << "stat of remote obj: z=" << sc->source_zone |
54 | << " b=" << src_bucket << " k=" << key | |
a8e16298 | 55 | << " size=" << size << " mtime=" << mtime << dendl; |
7c673cae FG |
56 | yield { |
57 | RGWStatRemoteObjCBCR *cb = allocate_callback(); | |
58 | if (cb) { | |
11fdf7f2 | 59 | cb->set_result(mtime, size, etag, std::move(attrs), std::move(headers)); |
7c673cae FG |
60 | call(cb); |
61 | } | |
62 | } | |
63 | if (retcode < 0) { | |
11fdf7f2 | 64 | ldout(sync_env->cct, 10) << "RGWStatRemoteObjCR() callback returned " << retcode << dendl; |
7c673cae FG |
65 | return set_cr_error(retcode); |
66 | } | |
67 | return set_cr_done(); | |
68 | } | |
69 | return 0; | |
70 | } | |
71 | ||
72 | void rgw_register_sync_modules(RGWSyncModulesManager *modules_manager) | |
73 | { | |
74 | RGWSyncModuleRef default_module(std::make_shared<RGWDefaultSyncModule>()); | |
75 | modules_manager->register_module("rgw", default_module, true); | |
76 | ||
11fdf7f2 TL |
77 | RGWSyncModuleRef archive_module(std::make_shared<RGWArchiveSyncModule>()); |
78 | modules_manager->register_module("archive", archive_module); | |
79 | ||
7c673cae FG |
80 | RGWSyncModuleRef log_module(std::make_shared<RGWLogSyncModule>()); |
81 | modules_manager->register_module("log", log_module); | |
82 | ||
83 | RGWSyncModuleRef es_module(std::make_shared<RGWElasticSyncModule>()); | |
84 | modules_manager->register_module("elasticsearch", es_module); | |
11fdf7f2 TL |
85 | |
86 | RGWSyncModuleRef aws_module(std::make_shared<RGWAWSSyncModule>()); | |
87 | modules_manager->register_module("cloud", aws_module); | |
88 | ||
89 | RGWSyncModuleRef pubsub_module(std::make_shared<RGWPSSyncModule>()); | |
90 | modules_manager->register_module("pubsub", pubsub_module); | |
7c673cae | 91 | } |