]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_zone.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rgw / services / svc_zone.h
1 #ifndef CEPH_RGW_SERVICES_ZONE_H
2 #define CEPH_RGW_SERVICES_ZONE_H
3
4
5 #include "rgw/rgw_service.h"
6
7
8 class RGWSI_RADOS;
9 class RGWSI_SysObj;
10 class RGWSI_SyncModules;
11
12 class RGWRealm;
13 class RGWZoneGroup;
14 class RGWZone;
15 class RGWZoneParams;
16 class RGWPeriod;
17 class RGWZonePlacementInfo;
18
19 class RGWRESTConn;
20
21 class RGWSI_Zone : public RGWServiceInstance
22 {
23 friend struct RGWServices_Def;
24
25 RGWSI_SysObj *sysobj_svc{nullptr};
26 RGWSI_RADOS *rados_svc{nullptr};
27 RGWSI_SyncModules *sync_modules_svc{nullptr};
28
29 RGWRealm *realm{nullptr};
30 RGWZoneGroup *zonegroup{nullptr};
31 RGWZone *zone_public_config{nullptr}; /* external zone params, e.g., entrypoints, log flags, etc. */
32 RGWZoneParams *zone_params{nullptr}; /* internal zone params, e.g., rados pools */
33 RGWPeriod *current_period{nullptr};
34 uint32_t zone_short_id{0};
35 bool writeable_zone{false};
36
37 RGWRESTConn *rest_master_conn{nullptr};
38 map<string, RGWRESTConn *> zone_conn_map;
39 map<string, RGWRESTConn *> zone_data_sync_from_map;
40 map<string, RGWRESTConn *> zone_data_notify_to_map;
41 map<string, RGWRESTConn *> zonegroup_conn_map;
42
43 map<string, string> zone_id_by_name;
44 map<string, RGWZone> zone_by_id;
45
46 void init(RGWSI_SysObj *_sysobj_svc,
47 RGWSI_RADOS *_rados_svc,
48 RGWSI_SyncModules *_sync_modules_svc);
49 int do_start() override;
50 void shutdown() override;
51
52 int replace_region_with_zonegroup();
53 int init_zg_from_period(bool *initialized);
54 int init_zg_from_local(bool *creating_defaults);
55 int convert_regionmap();
56
57 int update_placement_map();
58 public:
59 RGWSI_Zone(CephContext *cct);
60 ~RGWSI_Zone();
61
62 const RGWZoneParams& get_zone_params() const;
63 const RGWPeriod& get_current_period() const;
64 const RGWRealm& get_realm() const;
65 const RGWZoneGroup& get_zonegroup() const;
66 int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) const;
67 const RGWZone& get_zone() const;
68
69 const string& zone_name();
70 const string& zone_id();
71 uint32_t get_zone_short_id() const;
72
73 const string& get_current_period_id();
74 bool has_zonegroup_api(const std::string& api) const;
75
76 bool zone_is_writeable();
77 bool zone_syncs_from(const RGWZone& target_zone, const RGWZone& source_zone) const;
78 bool get_redirect_zone_endpoint(string *endpoint);
79
80 RGWRESTConn *get_master_conn() {
81 return rest_master_conn;
82 }
83
84 map<string, RGWRESTConn *>& get_zonegroup_conn_map() {
85 return zonegroup_conn_map;
86 }
87
88 map<string, RGWRESTConn *>& get_zone_conn_map() {
89 return zone_conn_map;
90 }
91
92 map<string, RGWRESTConn *>& get_zone_data_sync_from_map() {
93 return zone_data_sync_from_map;
94 }
95
96 map<string, RGWRESTConn *>& get_zone_data_notify_to_map() {
97 return zone_data_notify_to_map;
98 }
99
100 bool find_zone_by_id(const string& id, RGWZone **zone);
101
102 RGWRESTConn *get_zone_conn_by_id(const string& id);
103 RGWRESTConn *get_zone_conn_by_name(const string& name);
104 bool find_zone_id_by_name(const string& name, string *id);
105
106 int select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id,
107 const rgw_placement_rule& rule,
108 rgw_placement_rule *pselected_rule, RGWZonePlacementInfo *rule_info);
109 int select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info);
110 int select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id,
111 const rgw_placement_rule& rule,
112 rgw_placement_rule *pselected_rule_name, RGWZonePlacementInfo *rule_info);
113 int select_bucket_location_by_rule(const rgw_placement_rule& location_rule, RGWZonePlacementInfo *rule_info);
114
115 int add_bucket_placement(const rgw_pool& new_pool);
116 int remove_bucket_placement(const rgw_pool& old_pool);
117 int list_placement_set(set<rgw_pool>& names);
118
119 bool is_meta_master() const;
120
121 bool need_to_log_data() const;
122 bool need_to_log_metadata() const;
123 bool can_reshard() const;
124 bool is_syncing_bucket_meta(const rgw_bucket& bucket);
125
126 int list_zonegroups(list<string>& zonegroups);
127 int list_regions(list<string>& regions);
128 int list_zones(list<string>& zones);
129 int list_realms(list<string>& realms);
130 int list_periods(list<string>& periods);
131 int list_periods(const string& current_period, list<string>& periods);
132 };
133
134 #endif