|
10 | 10 | #include "rgw_sync_policy.h" |
11 | 11 |
|
12 | 12 |
|
13 | | -class RGWSyncModulesManager; |
14 | | - |
15 | | -class RGWSI_SysObj; |
16 | | -class RGWSI_Zone; |
17 | | - |
18 | | -class RGWSystemMetaObj { |
19 | | -public: |
20 | | - std::string id; |
21 | | - std::string name; |
22 | | - |
23 | | - CephContext *cct{nullptr}; |
24 | | - RGWSI_SysObj *sysobj_svc{nullptr}; |
25 | | - RGWSI_Zone *zone_svc{nullptr}; |
26 | | - |
27 | | - int store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y); |
28 | | - int store_info(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y); |
29 | | - int read_info(const DoutPrefixProvider *dpp, const std::string& obj_id, optional_yield y, bool old_format = false); |
30 | | - int read_id(const DoutPrefixProvider *dpp, const std::string& obj_name, std::string& obj_id, optional_yield y); |
31 | | - int read_default(const DoutPrefixProvider *dpp, |
32 | | - RGWDefaultSystemMetaObjInfo& default_info, |
33 | | - const std::string& oid, |
34 | | - optional_yield y); |
35 | | - /* read and use default id */ |
36 | | - int use_default(const DoutPrefixProvider *dpp, optional_yield y, bool old_format = false); |
37 | | - |
38 | | -public: |
39 | | - RGWSystemMetaObj() {} |
40 | | - RGWSystemMetaObj(const std::string& _name): name(_name) {} |
41 | | - RGWSystemMetaObj(const std::string& _id, const std::string& _name) : id(_id), name(_name) {} |
42 | | - RGWSystemMetaObj(CephContext *_cct, RGWSI_SysObj *_sysobj_svc) { |
43 | | - reinit_instance(_cct, _sysobj_svc); |
44 | | - } |
45 | | - RGWSystemMetaObj(const std::string& _name, CephContext *_cct, RGWSI_SysObj *_sysobj_svc): name(_name) { |
46 | | - reinit_instance(_cct, _sysobj_svc); |
47 | | - } |
48 | | - |
49 | | - const std::string& get_name() const { return name; } |
50 | | - const std::string& get_id() const { return id; } |
51 | | - |
52 | | - void set_name(const std::string& _name) { name = _name;} |
53 | | - void set_id(const std::string& _id) { id = _id;} |
54 | | - void clear_id() { id.clear(); } |
55 | | - |
56 | | - virtual ~RGWSystemMetaObj() {} |
57 | | - |
58 | | - virtual void encode(bufferlist& bl) const { |
59 | | - ENCODE_START(1, 1, bl); |
60 | | - encode(id, bl); |
61 | | - encode(name, bl); |
62 | | - ENCODE_FINISH(bl); |
63 | | - } |
64 | | - |
65 | | - virtual void decode(bufferlist::const_iterator& bl) { |
66 | | - DECODE_START(1, bl); |
67 | | - decode(id, bl); |
68 | | - decode(name, bl); |
69 | | - DECODE_FINISH(bl); |
70 | | - } |
71 | | - |
72 | | - void reinit_instance(CephContext *_cct, RGWSI_SysObj *_sysobj_svc); |
73 | | - int init(const DoutPrefixProvider *dpp, CephContext *_cct, RGWSI_SysObj *_sysobj_svc, |
74 | | - optional_yield y, |
75 | | - bool setup_obj = true, bool old_format = false); |
76 | | - virtual int read_default_id(const DoutPrefixProvider *dpp, std::string& default_id, optional_yield y, |
77 | | - bool old_format = false); |
78 | | - virtual int set_as_default(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = false); |
79 | | - int delete_default(); |
80 | | - virtual int create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = true); |
81 | | - int delete_obj(const DoutPrefixProvider *dpp, optional_yield y, bool old_format = false); |
82 | | - int rename(const DoutPrefixProvider *dpp, const std::string& new_name, optional_yield y); |
83 | | - int update(const DoutPrefixProvider *dpp, optional_yield y) { return store_info(dpp, false, y);} |
84 | | - int update_name(const DoutPrefixProvider *dpp, optional_yield y) { return store_name(dpp, false, y);} |
85 | | - int read(const DoutPrefixProvider *dpp, optional_yield y); |
86 | | - int write(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y); |
87 | | - |
88 | | - virtual rgw_pool get_pool(CephContext *cct) const = 0; |
89 | | - virtual const std::string get_default_oid(bool old_format = false) const = 0; |
90 | | - virtual const std::string& get_names_oid_prefix() const = 0; |
91 | | - virtual const std::string& get_info_oid_prefix(bool old_format = false) const = 0; |
92 | | - virtual std::string get_predefined_id(CephContext *cct) const = 0; |
93 | | - virtual const std::string& get_predefined_name(CephContext *cct) const = 0; |
94 | | - |
95 | | - void dump(Formatter *f) const; |
96 | | - void decode_json(JSONObj *obj); |
97 | | -}; |
98 | | -WRITE_CLASS_ENCODER(RGWSystemMetaObj) |
99 | | - |
100 | 13 | struct RGWZoneParams { |
101 | 14 | std::string id; |
102 | 15 | std::string name; |
|
0 commit comments