]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_zone.h
1 #ifndef CEPH_RGW_SERVICES_ZONE_H
2 #define CEPH_RGW_SERVICES_ZONE_H
5 #include "rgw/rgw_service.h"
10 class RGWSI_SyncModules
;
17 class RGWZonePlacementInfo
;
21 class RGWSI_Zone
: public RGWServiceInstance
23 friend struct RGWServices_Def
;
25 RGWSI_SysObj
*sysobj_svc
{nullptr};
26 RGWSI_RADOS
*rados_svc
{nullptr};
27 RGWSI_SyncModules
*sync_modules_svc
{nullptr};
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};
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
;
43 map
<string
, string
> zone_id_by_name
;
44 map
<string
, RGWZone
> zone_by_id
;
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
;
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();
57 int update_placement_map();
59 RGWSI_Zone(CephContext
*cct
);
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;
69 const string
& zone_name();
70 const string
& zone_id();
71 uint32_t get_zone_short_id() const;
73 const string
& get_current_period_id();
74 bool has_zonegroup_api(const std::string
& api
) const;
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
);
80 RGWRESTConn
*get_master_conn() {
81 return rest_master_conn
;
84 map
<string
, RGWRESTConn
*>& get_zonegroup_conn_map() {
85 return zonegroup_conn_map
;
88 map
<string
, RGWRESTConn
*>& get_zone_conn_map() {
92 map
<string
, RGWRESTConn
*>& get_zone_data_sync_from_map() {
93 return zone_data_sync_from_map
;
96 map
<string
, RGWRESTConn
*>& get_zone_data_notify_to_map() {
97 return zone_data_notify_to_map
;
100 bool find_zone_by_id(const string
& id
, RGWZone
**zone
);
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
);
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
);
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
);
119 bool is_meta_master() const;
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
);
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
);