]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/driver/rados/config/store.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rgw / driver / rados / config / store.h
1 // vim: ts=8 sw=2 smarttab ft=cpp
2
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2022 Red Hat, Inc.
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15 #pragma once
16
17 #include <list>
18 #include <memory>
19 #include <string>
20 #include "rgw_common.h"
21 #include "rgw_sal_config.h"
22
23 class DoutPrefixProvider;
24 class optional_yield;
25
26 namespace rgw::rados {
27
28 struct ConfigImpl;
29
30 class RadosConfigStore : public sal::ConfigStore {
31 public:
32 explicit RadosConfigStore(std::unique_ptr<ConfigImpl> impl);
33 virtual ~RadosConfigStore() override;
34
35 // Realm
36 virtual int write_default_realm_id(const DoutPrefixProvider* dpp,
37 optional_yield y, bool exclusive,
38 std::string_view realm_id) override;
39 virtual int read_default_realm_id(const DoutPrefixProvider* dpp,
40 optional_yield y,
41 std::string& realm_id) override;
42 virtual int delete_default_realm_id(const DoutPrefixProvider* dpp,
43 optional_yield y) override;
44
45 virtual int create_realm(const DoutPrefixProvider* dpp,
46 optional_yield y, bool exclusive,
47 const RGWRealm& info,
48 std::unique_ptr<sal::RealmWriter>* writer) override;
49 virtual int read_realm_by_id(const DoutPrefixProvider* dpp,
50 optional_yield y,
51 std::string_view realm_id,
52 RGWRealm& info,
53 std::unique_ptr<sal::RealmWriter>* writer) override;
54 virtual int read_realm_by_name(const DoutPrefixProvider* dpp,
55 optional_yield y,
56 std::string_view realm_name,
57 RGWRealm& info,
58 std::unique_ptr<sal::RealmWriter>* writer) override;
59 virtual int read_default_realm(const DoutPrefixProvider* dpp,
60 optional_yield y,
61 RGWRealm& info,
62 std::unique_ptr<sal::RealmWriter>* writer) override;
63 virtual int read_realm_id(const DoutPrefixProvider* dpp,
64 optional_yield y, std::string_view realm_name,
65 std::string& realm_id) override;
66 virtual int realm_notify_new_period(const DoutPrefixProvider* dpp,
67 optional_yield y,
68 const RGWPeriod& period) override;
69 virtual int list_realm_names(const DoutPrefixProvider* dpp,
70 optional_yield y, const std::string& marker,
71 std::span<std::string> entries,
72 sal::ListResult<std::string>& result) override;
73
74 // Period
75 virtual int create_period(const DoutPrefixProvider* dpp,
76 optional_yield y, bool exclusive,
77 const RGWPeriod& info) override;
78 virtual int read_period(const DoutPrefixProvider* dpp,
79 optional_yield y, std::string_view period_id,
80 std::optional<uint32_t> epoch, RGWPeriod& info) override;
81 virtual int delete_period(const DoutPrefixProvider* dpp,
82 optional_yield y,
83 std::string_view period_id) override;
84 virtual int list_period_ids(const DoutPrefixProvider* dpp,
85 optional_yield y, const std::string& marker,
86 std::span<std::string> entries,
87 sal::ListResult<std::string>& result) override;
88
89 // ZoneGroup
90 virtual int write_default_zonegroup_id(const DoutPrefixProvider* dpp,
91 optional_yield y, bool exclusive,
92 std::string_view realm_id,
93 std::string_view zonegroup_id) override;
94 virtual int read_default_zonegroup_id(const DoutPrefixProvider* dpp,
95 optional_yield y,
96 std::string_view realm_id,
97 std::string& zonegroup_id) override;
98 virtual int delete_default_zonegroup_id(const DoutPrefixProvider* dpp,
99 optional_yield y,
100 std::string_view realm_id) override;
101
102 virtual int create_zonegroup(const DoutPrefixProvider* dpp,
103 optional_yield y, bool exclusive,
104 const RGWZoneGroup& info,
105 std::unique_ptr<sal::ZoneGroupWriter>* writer) override;
106 virtual int read_zonegroup_by_id(const DoutPrefixProvider* dpp,
107 optional_yield y,
108 std::string_view zonegroup_id,
109 RGWZoneGroup& info,
110 std::unique_ptr<sal::ZoneGroupWriter>* writer) override;
111 virtual int read_zonegroup_by_name(const DoutPrefixProvider* dpp,
112 optional_yield y,
113 std::string_view zonegroup_name,
114 RGWZoneGroup& info,
115 std::unique_ptr<sal::ZoneGroupWriter>* writer) override;
116 virtual int read_default_zonegroup(const DoutPrefixProvider* dpp,
117 optional_yield y,
118 std::string_view realm_id,
119 RGWZoneGroup& info,
120 std::unique_ptr<sal::ZoneGroupWriter>* writer) override;
121 virtual int list_zonegroup_names(const DoutPrefixProvider* dpp,
122 optional_yield y, const std::string& marker,
123 std::span<std::string> entries,
124 sal::ListResult<std::string>& result) override;
125
126 // Zone
127 virtual int write_default_zone_id(const DoutPrefixProvider* dpp,
128 optional_yield y, bool exclusive,
129 std::string_view realm_id,
130 std::string_view zone_id) override;
131 virtual int read_default_zone_id(const DoutPrefixProvider* dpp,
132 optional_yield y,
133 std::string_view realm_id,
134 std::string& zone_id) override;
135 virtual int delete_default_zone_id(const DoutPrefixProvider* dpp,
136 optional_yield y,
137 std::string_view realm_id) override;
138
139 virtual int create_zone(const DoutPrefixProvider* dpp,
140 optional_yield y, bool exclusive,
141 const RGWZoneParams& info,
142 std::unique_ptr<sal::ZoneWriter>* writer) override;
143 virtual int read_zone_by_id(const DoutPrefixProvider* dpp,
144 optional_yield y,
145 std::string_view zone_id,
146 RGWZoneParams& info,
147 std::unique_ptr<sal::ZoneWriter>* writer) override;
148 virtual int read_zone_by_name(const DoutPrefixProvider* dpp,
149 optional_yield y,
150 std::string_view zone_name,
151 RGWZoneParams& info,
152 std::unique_ptr<sal::ZoneWriter>* writer) override;
153 virtual int read_default_zone(const DoutPrefixProvider* dpp,
154 optional_yield y,
155 std::string_view realm_id,
156 RGWZoneParams& info,
157 std::unique_ptr<sal::ZoneWriter>* writer) override;
158 virtual int list_zone_names(const DoutPrefixProvider* dpp,
159 optional_yield y, const std::string& marker,
160 std::span<std::string> entries,
161 sal::ListResult<std::string>& result) override;
162
163 // PeriodConfig
164 virtual int read_period_config(const DoutPrefixProvider* dpp,
165 optional_yield y,
166 std::string_view realm_id,
167 RGWPeriodConfig& info) override;
168 virtual int write_period_config(const DoutPrefixProvider* dpp,
169 optional_yield y, bool exclusive,
170 std::string_view realm_id,
171 const RGWPeriodConfig& info) override;
172
173 private:
174 std::unique_ptr<ConfigImpl> impl;
175 }; // RadosConfigStore
176
177
178 /// RadosConfigStore factory function
179 auto create_config_store(const DoutPrefixProvider* dpp)
180 -> std::unique_ptr<RadosConfigStore>;
181
182 } // namespace rgw::rados