]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_sync_modules.cc
import 15.2.0 Octopus source
[ceph.git] / ceph / src / rgw / services / svc_sync_modules.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 #include "svc_sync_modules.h"
5 #include "svc_zone.h"
6
7 #include "rgw/rgw_sync_module.h"
8 #include "rgw/rgw_zone.h"
9
10 #define dout_subsys ceph_subsys_rgw
11
12 void RGWSI_SyncModules::init(RGWSI_Zone *zone_svc)
13 {
14 svc.zone = zone_svc;
15 sync_modules_manager = new RGWSyncModulesManager();
16 rgw_register_sync_modules(sync_modules_manager);
17 }
18
19 int RGWSI_SyncModules::do_start()
20 {
21 auto& zone_public_config = svc.zone->get_zone();
22
23 int ret = sync_modules_manager->create_instance(cct, zone_public_config.tier_type, svc.zone->get_zone_params().tier_config, &sync_module);
24 if (ret < 0) {
25 lderr(cct) << "ERROR: failed to start sync module instance, ret=" << ret << dendl;
26 if (ret == -ENOENT) {
27 lderr(cct) << "ERROR: " << zone_public_config.tier_type
28 << " sync module does not exist. valid sync modules: "
29 << sync_modules_manager->get_registered_module_names()
30 << dendl;
31 }
32 return ret;
33 }
34
35 ldout(cct, 20) << "started sync module instance, tier type = " << zone_public_config.tier_type << dendl;
36
37 return 0;
38 }
39
40 RGWSI_SyncModules::~RGWSI_SyncModules()
41 {
42 delete sync_modules_manager;
43 }
44