]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
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 | /* | |
5 | * Ceph - scalable distributed file system | |
6 | * | |
7 | * Copyright (C) 2022 Red Hat, Inc. | |
8 | * | |
9 | * This is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License version 2.1, as published by the Free Software | |
12 | * Foundation. See file COPYING. | |
13 | * | |
14 | */ | |
15 | ||
16 | #pragma once | |
17 | ||
18 | #include "rgw_sal.h" | |
19 | #include "rgw_oidc_provider.h" | |
20 | #include "rgw_role.h" | |
21 | ||
22 | namespace rgw { namespace sal { | |
23 | ||
24 | class FilterCompletions : public Completions { | |
25 | protected: | |
26 | std::unique_ptr<Completions> next; | |
27 | ||
28 | public: | |
29 | FilterCompletions(std::unique_ptr<Completions> _next) : next(std::move(_next)) {} | |
30 | virtual ~FilterCompletions() = default; | |
31 | virtual int drain() override { return next->drain(); } | |
32 | }; | |
33 | ||
34 | class FilterPlacementTier : public PlacementTier { | |
35 | protected: | |
36 | std::unique_ptr<PlacementTier> next; | |
37 | ||
38 | public: | |
39 | FilterPlacementTier(std::unique_ptr<PlacementTier> _next) : next(std::move(_next)) {} | |
40 | virtual ~FilterPlacementTier() = default; | |
41 | ||
42 | virtual const std::string& get_tier_type() override { return next->get_tier_type(); } | |
43 | virtual const std::string& get_storage_class() override { return next->get_storage_class(); } | |
44 | virtual bool retain_head_object() override { return next->retain_head_object(); } | |
45 | ||
46 | /* Internal to Filters */ | |
47 | PlacementTier* get_next() { return next.get(); } | |
48 | }; | |
49 | ||
50 | class FilterZoneGroup : public ZoneGroup { | |
51 | protected: | |
52 | std::unique_ptr<ZoneGroup> next; | |
53 | ||
54 | public: | |
55 | FilterZoneGroup(std::unique_ptr<ZoneGroup> _next) : next(std::move(_next)) {} | |
56 | virtual ~FilterZoneGroup() = default; | |
57 | virtual const std::string& get_id() const override | |
58 | { return next->get_id(); } | |
59 | virtual const std::string& get_name() const override | |
60 | { return next->get_name(); } | |
61 | virtual int equals(const std::string& other_zonegroup) const override | |
62 | { return next->equals(other_zonegroup); } | |
63 | virtual const std::string& get_endpoint() const override | |
64 | { return next->get_endpoint(); } | |
65 | virtual bool placement_target_exists(std::string& target) const override | |
66 | { return next->placement_target_exists(target); } | |
67 | virtual bool is_master_zonegroup() const override | |
68 | { return next->is_master_zonegroup(); } | |
69 | virtual const std::string& get_api_name() const override | |
70 | { return next->get_api_name(); } | |
aee94f69 TL |
71 | virtual void get_placement_target_names(std::set<std::string>& names) const override |
72 | { next->get_placement_target_names(names); } | |
1e59de90 TL |
73 | virtual const std::string& get_default_placement_name() const override |
74 | { return next->get_default_placement_name(); } | |
75 | virtual int get_hostnames(std::list<std::string>& names) const override | |
76 | { return next->get_hostnames(names); } | |
77 | virtual int get_s3website_hostnames(std::list<std::string>& names) const override | |
78 | { return next->get_s3website_hostnames(names); } | |
79 | virtual int get_zone_count() const override | |
80 | { return next->get_zone_count(); } | |
81 | virtual int get_placement_tier(const rgw_placement_rule& rule, std::unique_ptr<PlacementTier>* tier) override; | |
82 | virtual int get_zone_by_id(const std::string& id, std::unique_ptr<Zone>* zone) override; | |
83 | virtual int get_zone_by_name(const std::string& name, std::unique_ptr<Zone>* zone) override; | |
84 | virtual int list_zones(std::list<std::string>& zone_ids) override | |
85 | { return next->list_zones(zone_ids); } | |
05a536ef TL |
86 | bool supports(std::string_view feature) const override { |
87 | return next->supports(feature); | |
88 | } | |
1e59de90 TL |
89 | virtual std::unique_ptr<ZoneGroup> clone() override { |
90 | std::unique_ptr<ZoneGroup> nzg = next->clone(); | |
91 | return std::make_unique<FilterZoneGroup>(std::move(nzg)); | |
92 | } | |
93 | }; | |
94 | ||
95 | class FilterZone : public Zone { | |
96 | protected: | |
97 | std::unique_ptr<Zone> next; | |
98 | private: | |
99 | std::unique_ptr<ZoneGroup> group; | |
100 | ||
101 | public: | |
102 | FilterZone(std::unique_ptr<Zone> _next) : next(std::move(_next)) | |
103 | { | |
104 | group = std::make_unique<FilterZoneGroup>(next->get_zonegroup().clone()); | |
105 | } | |
106 | virtual ~FilterZone() = default; | |
107 | ||
108 | virtual std::unique_ptr<Zone> clone() override { | |
109 | std::unique_ptr<Zone> nz = next->clone(); | |
110 | return std::make_unique<FilterZone>(std::move(nz)); | |
111 | } | |
112 | virtual ZoneGroup& get_zonegroup() override { | |
113 | return *group.get(); | |
114 | } | |
115 | virtual const std::string& get_id() override { | |
116 | return next->get_id(); | |
117 | } | |
118 | virtual const std::string& get_name() const override { | |
119 | return next->get_name(); | |
120 | } | |
121 | virtual bool is_writeable() override { | |
122 | return next->is_writeable(); | |
123 | } | |
124 | virtual bool get_redirect_endpoint(std::string* endpoint) override { | |
125 | return next->get_redirect_endpoint(endpoint); | |
126 | } | |
127 | virtual bool has_zonegroup_api(const std::string& api) const override { | |
128 | return next->has_zonegroup_api(api); | |
129 | } | |
130 | virtual const std::string& get_current_period_id() override { | |
131 | return next->get_current_period_id(); | |
132 | } | |
133 | virtual const RGWAccessKey& get_system_key() override { | |
134 | return next->get_system_key(); | |
135 | } | |
136 | virtual const std::string& get_realm_name() override { | |
137 | return next->get_realm_name(); | |
138 | } | |
139 | virtual const std::string& get_realm_id() override { | |
140 | return next->get_realm_id(); | |
141 | } | |
142 | virtual const std::string_view get_tier_type() override { | |
143 | return next->get_tier_type(); | |
144 | } | |
145 | virtual RGWBucketSyncPolicyHandlerRef get_sync_policy_handler() override { | |
146 | return next->get_sync_policy_handler(); | |
147 | } | |
148 | }; | |
149 | ||
150 | class FilterDriver : public Driver { | |
151 | protected: | |
152 | Driver* next; | |
153 | private: | |
154 | std::unique_ptr<FilterZone> zone; | |
155 | ||
156 | public: | |
157 | FilterDriver(Driver* _next) : next(_next) {} | |
158 | virtual ~FilterDriver() = default; | |
159 | ||
160 | virtual int initialize(CephContext *cct, const DoutPrefixProvider *dpp) override; | |
161 | virtual const std::string get_name() const override; | |
162 | virtual std::string get_cluster_id(const DoutPrefixProvider* dpp, | |
163 | optional_yield y) override; | |
164 | virtual std::unique_ptr<User> get_user(const rgw_user& u) override; | |
165 | virtual int get_user_by_access_key(const DoutPrefixProvider* dpp, const | |
166 | std::string& key, optional_yield y, | |
167 | std::unique_ptr<User>* user) override; | |
168 | virtual int get_user_by_email(const DoutPrefixProvider* dpp, const | |
169 | std::string& email, optional_yield y, | |
170 | std::unique_ptr<User>* user) override; | |
171 | virtual int get_user_by_swift(const DoutPrefixProvider* dpp, const | |
172 | std::string& user_str, optional_yield y, | |
173 | std::unique_ptr<User>* user) override; | |
174 | virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override; | |
175 | virtual int get_bucket(User* u, const RGWBucketInfo& i, | |
176 | std::unique_ptr<Bucket>* bucket) override; | |
177 | virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const | |
178 | rgw_bucket& b, std::unique_ptr<Bucket>* bucket, | |
179 | optional_yield y) override; | |
180 | virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const | |
181 | std::string& tenant, const std::string& name, | |
182 | std::unique_ptr<Bucket>* bucket, optional_yield y) override; | |
183 | virtual bool is_meta_master() override; | |
184 | virtual int forward_request_to_master(const DoutPrefixProvider *dpp, User* user, | |
185 | obj_version* objv, bufferlist& in_data, | |
186 | JSONParser* jp, req_info& info, | |
187 | optional_yield y) override; | |
188 | virtual int forward_iam_request_to_master(const DoutPrefixProvider *dpp, | |
189 | const RGWAccessKey& key, | |
190 | obj_version* objv, | |
191 | bufferlist& in_data, | |
192 | RGWXMLDecoder::XMLParser* parser, | |
193 | req_info& info, | |
194 | optional_yield y) override; | |
195 | virtual Zone* get_zone() override { return zone.get(); } | |
196 | virtual std::string zone_unique_id(uint64_t unique_num) override; | |
197 | virtual std::string zone_unique_trans_id(const uint64_t unique_num) override; | |
198 | virtual int get_zonegroup(const std::string& id, std::unique_ptr<ZoneGroup>* zonegroup) override; | |
199 | virtual int list_all_zones(const DoutPrefixProvider* dpp, std::list<std::string>& zone_ids) override { | |
200 | return next->list_all_zones(dpp, zone_ids); | |
201 | } | |
202 | virtual int cluster_stat(RGWClusterStat& stats) override; | |
203 | virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override; | |
204 | virtual std::unique_ptr<Completions> get_completions(void) override; | |
205 | ||
206 | virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj, | |
207 | rgw::sal::Object* src_obj, struct req_state* s, | |
208 | rgw::notify::EventType event_type, optional_yield y, | |
209 | const std::string* object_name=nullptr) override; | |
210 | virtual std::unique_ptr<Notification> get_notification( | |
211 | const DoutPrefixProvider* dpp, rgw::sal::Object* obj, rgw::sal::Object* src_obj, | |
212 | ||
213 | rgw::notify::EventType event_type, rgw::sal::Bucket* _bucket, | |
214 | std::string& _user_id, std::string& _user_tenant, | |
215 | std::string& _req_id, optional_yield y) override; | |
216 | ||
217 | int read_topics(const std::string& tenant, rgw_pubsub_topics& topics, RGWObjVersionTracker* objv_tracker, | |
218 | optional_yield y, const DoutPrefixProvider *dpp) override { | |
219 | return next->read_topics(tenant, topics, objv_tracker, y, dpp); | |
220 | } | |
221 | int write_topics(const std::string& tenant, const rgw_pubsub_topics& topics, RGWObjVersionTracker* objv_tracker, | |
222 | optional_yield y, const DoutPrefixProvider *dpp) override { | |
223 | return next->write_topics(tenant, topics, objv_tracker, y, dpp); | |
224 | } | |
225 | int remove_topics(const std::string& tenant, RGWObjVersionTracker* objv_tracker, | |
226 | optional_yield y, const DoutPrefixProvider *dpp) override { | |
227 | return next->remove_topics(tenant, objv_tracker, y, dpp); | |
228 | } | |
229 | ||
230 | virtual RGWLC* get_rgwlc(void) override; | |
231 | virtual RGWCoroutinesManagerRegistry* get_cr_registry() override; | |
232 | ||
233 | virtual int log_usage(const DoutPrefixProvider *dpp, std::map<rgw_user_bucket, | |
234 | RGWUsageBatch>& usage_info) override; | |
235 | virtual int log_op(const DoutPrefixProvider *dpp, std::string& oid, | |
236 | bufferlist& bl) override; | |
237 | virtual int register_to_service_map(const DoutPrefixProvider *dpp, const | |
238 | std::string& daemon_type, | |
239 | const std::map<std::string, | |
240 | std::string>& meta) override; | |
241 | virtual void get_quota(RGWQuota& quota) override; | |
242 | virtual void get_ratelimit(RGWRateLimitInfo& bucket_ratelimit, | |
243 | RGWRateLimitInfo& user_ratelimit, | |
244 | RGWRateLimitInfo& anon_ratelimit) override; | |
245 | virtual int set_buckets_enabled(const DoutPrefixProvider* dpp, | |
246 | std::vector<rgw_bucket>& buckets, | |
247 | bool enabled) override; | |
248 | virtual uint64_t get_new_req_id() override; | |
249 | virtual int get_sync_policy_handler(const DoutPrefixProvider* dpp, | |
250 | std::optional<rgw_zone_id> zone, | |
251 | std::optional<rgw_bucket> bucket, | |
252 | RGWBucketSyncPolicyHandlerRef* phandler, | |
253 | optional_yield y) override; | |
254 | virtual RGWDataSyncStatusManager* get_data_sync_manager(const rgw_zone_id& source_zone) override; | |
255 | virtual void wakeup_meta_sync_shards(std::set<int>& shard_ids) override; | |
256 | virtual void wakeup_data_sync_shards(const DoutPrefixProvider *dpp, | |
257 | const rgw_zone_id& source_zone, | |
258 | boost::container::flat_map<int, boost::container::flat_set<rgw_data_notify_entry>>& shard_ids) override; | |
259 | virtual int clear_usage(const DoutPrefixProvider *dpp) override; | |
260 | virtual int read_all_usage(const DoutPrefixProvider *dpp, | |
261 | uint64_t start_epoch, uint64_t end_epoch, | |
262 | uint32_t max_entries, bool* is_truncated, | |
263 | RGWUsageIter& usage_iter, | |
264 | std::map<rgw_user_bucket, rgw_usage_log_entry>& usage) override; | |
265 | virtual int trim_all_usage(const DoutPrefixProvider *dpp, | |
266 | uint64_t start_epoch, uint64_t end_epoch) override; | |
267 | virtual int get_config_key_val(std::string name, bufferlist* bl) override; | |
268 | virtual int meta_list_keys_init(const DoutPrefixProvider *dpp, | |
269 | const std::string& section, | |
270 | const std::string& marker, | |
271 | void** phandle) override; | |
272 | virtual int meta_list_keys_next(const DoutPrefixProvider *dpp, void* handle, | |
273 | int max, std::list<std::string>& keys, | |
274 | bool* truncated) override; | |
275 | virtual void meta_list_keys_complete(void* handle) override; | |
276 | virtual std::string meta_get_marker(void* handle) override; | |
277 | virtual int meta_remove(const DoutPrefixProvider* dpp, | |
278 | std::string& metadata_key, optional_yield y) override; | |
279 | virtual const RGWSyncModuleInstanceRef& get_sync_module() override; | |
280 | virtual std::string get_host_id() override { return next->get_host_id(); } | |
281 | virtual std::unique_ptr<LuaManager> get_lua_manager() override; | |
282 | virtual std::unique_ptr<RGWRole> get_role(std::string name, | |
283 | std::string tenant, | |
284 | std::string path="", | |
285 | std::string trust_policy="", | |
286 | std::string | |
287 | max_session_duration_str="", | |
288 | std::multimap<std::string,std::string> tags={}) override; | |
289 | virtual std::unique_ptr<RGWRole> get_role(std::string id) override; | |
290 | virtual std::unique_ptr<RGWRole> get_role(const RGWRoleInfo& info) override; | |
291 | virtual int get_roles(const DoutPrefixProvider *dpp, | |
292 | optional_yield y, | |
293 | const std::string& path_prefix, | |
294 | const std::string& tenant, | |
295 | std::vector<std::unique_ptr<RGWRole>>& roles) override; | |
296 | virtual std::unique_ptr<RGWOIDCProvider> get_oidc_provider() override; | |
297 | virtual int get_oidc_providers(const DoutPrefixProvider *dpp, | |
298 | const std::string& tenant, | |
299 | std::vector<std::unique_ptr<RGWOIDCProvider>>& | |
300 | providers) override; | |
301 | virtual std::unique_ptr<Writer> get_append_writer(const DoutPrefixProvider *dpp, | |
302 | optional_yield y, | |
303 | rgw::sal::Object* obj, | |
304 | const rgw_user& owner, | |
305 | const rgw_placement_rule | |
306 | *ptail_placement_rule, | |
307 | const std::string& unique_tag, | |
308 | uint64_t position, | |
309 | uint64_t *cur_accounted_size) override; | |
310 | virtual std::unique_ptr<Writer> get_atomic_writer(const DoutPrefixProvider *dpp, | |
311 | optional_yield y, | |
312 | rgw::sal::Object* obj, | |
313 | const rgw_user& owner, | |
314 | const rgw_placement_rule *ptail_placement_rule, | |
315 | uint64_t olh_epoch, | |
316 | const std::string& unique_tag) override; | |
317 | ||
318 | virtual const std::string& get_compression_type(const rgw_placement_rule& rule) override; | |
319 | virtual bool valid_placement(const rgw_placement_rule& rule) override; | |
320 | ||
321 | virtual void finalize(void) override; | |
322 | ||
323 | virtual CephContext* ctx(void) override; | |
324 | ||
325 | virtual void register_admin_apis(RGWRESTMgr* mgr) override { | |
326 | return next->register_admin_apis(mgr); | |
327 | } | |
328 | }; | |
329 | ||
330 | class FilterUser : public User { | |
331 | protected: | |
332 | std::unique_ptr<User> next; | |
333 | ||
334 | public: | |
335 | FilterUser(std::unique_ptr<User> _next) : next(std::move(_next)) {} | |
336 | FilterUser(FilterUser& u) : next(u.next->clone()) {}; | |
337 | virtual ~FilterUser() = default; | |
338 | ||
339 | virtual std::unique_ptr<User> clone() override { | |
340 | return std::make_unique<FilterUser>(*this); | |
341 | } | |
342 | virtual int list_buckets(const DoutPrefixProvider* dpp, | |
343 | const std::string& marker, const std::string& end_marker, | |
344 | uint64_t max, bool need_stats, BucketList& buckets, | |
345 | optional_yield y) override; | |
346 | virtual int create_bucket(const DoutPrefixProvider* dpp, | |
347 | const rgw_bucket& b, | |
348 | const std::string& zonegroup_id, | |
349 | rgw_placement_rule& placement_rule, | |
350 | std::string& swift_ver_location, | |
351 | const RGWQuotaInfo* pquota_info, | |
352 | const RGWAccessControlPolicy& policy, | |
353 | Attrs& attrs, | |
354 | RGWBucketInfo& info, | |
355 | obj_version& ep_objv, | |
356 | bool exclusive, | |
357 | bool obj_lock_enabled, | |
358 | bool* existed, | |
359 | req_info& req_info, | |
360 | std::unique_ptr<Bucket>* bucket, | |
361 | optional_yield y) override; | |
362 | ||
363 | virtual std::string& get_display_name() override { return next->get_display_name(); } | |
364 | virtual const std::string& get_tenant() override { return next->get_tenant(); } | |
365 | virtual void set_tenant(std::string& _t) override { next->set_tenant(_t); } | |
366 | virtual const std::string& get_ns() override { return next->get_ns(); } | |
367 | virtual void set_ns(std::string& _ns) override { next->set_ns(_ns); } | |
368 | virtual void clear_ns() override { next->clear_ns(); } | |
369 | virtual const rgw_user& get_id() const override { return next->get_id(); } | |
370 | virtual uint32_t get_type() const override { return next->get_type(); } | |
371 | virtual int32_t get_max_buckets() const override { return next->get_max_buckets(); } | |
372 | virtual const RGWUserCaps& get_caps() const override { return next->get_caps(); } | |
373 | virtual RGWObjVersionTracker& get_version_tracker() override { | |
374 | return next->get_version_tracker(); | |
375 | } | |
376 | virtual Attrs& get_attrs() override { return next->get_attrs(); } | |
377 | virtual void set_attrs(Attrs& _attrs) override { next->set_attrs(_attrs); } | |
378 | virtual bool empty() const override { return next->empty(); } | |
379 | virtual int read_attrs(const DoutPrefixProvider* dpp, optional_yield y) override; | |
380 | virtual int merge_and_store_attrs(const DoutPrefixProvider* dpp, Attrs& | |
381 | new_attrs, optional_yield y) override; | |
382 | virtual int read_stats(const DoutPrefixProvider *dpp, | |
383 | optional_yield y, RGWStorageStats* stats, | |
384 | ceph::real_time* last_stats_sync = nullptr, | |
385 | ceph::real_time* last_stats_update = nullptr) override; | |
386 | virtual int read_stats_async(const DoutPrefixProvider *dpp, | |
387 | RGWGetUserStats_CB* cb) override; | |
388 | virtual int complete_flush_stats(const DoutPrefixProvider *dpp, optional_yield y) override; | |
389 | virtual int read_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, | |
390 | uint64_t end_epoch, uint32_t max_entries, | |
391 | bool* is_truncated, RGWUsageIter& usage_iter, | |
392 | std::map<rgw_user_bucket, rgw_usage_log_entry>& usage) override; | |
393 | virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, | |
394 | uint64_t end_epoch) override; | |
395 | ||
396 | virtual int load_user(const DoutPrefixProvider* dpp, optional_yield y) override; | |
397 | virtual int store_user(const DoutPrefixProvider* dpp, optional_yield y, bool | |
398 | exclusive, RGWUserInfo* old_info = nullptr) override; | |
399 | virtual int remove_user(const DoutPrefixProvider* dpp, optional_yield y) override; | |
400 | virtual int verify_mfa(const std::string& mfa_str, bool* verified, | |
401 | const DoutPrefixProvider* dpp, optional_yield y) override; | |
402 | ||
403 | RGWUserInfo& get_info() override { return next->get_info(); } | |
404 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
405 | ||
406 | /* Internal to Filters */ | |
407 | User* get_next() { return next.get(); } | |
408 | }; | |
409 | ||
410 | class FilterBucket : public Bucket { | |
411 | protected: | |
412 | std::unique_ptr<Bucket> next; | |
413 | private: | |
414 | User* user; | |
415 | ||
416 | public: | |
417 | ||
418 | FilterBucket(std::unique_ptr<Bucket> _next, User* _user) : | |
419 | next(std::move(_next)), user(_user) {} | |
420 | virtual ~FilterBucket() = default; | |
421 | ||
422 | virtual std::unique_ptr<Object> get_object(const rgw_obj_key& key) override; | |
423 | virtual int list(const DoutPrefixProvider* dpp, ListParams&, int, | |
424 | ListResults&, optional_yield y) override; | |
425 | virtual Attrs& get_attrs(void) override { return next->get_attrs(); } | |
426 | virtual int set_attrs(Attrs a) override { return next->set_attrs(a); } | |
427 | virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children, | |
428 | bool forward_to_master, req_info* req_info, | |
429 | optional_yield y) override; | |
430 | virtual int remove_bucket_bypass_gc(int concurrent_max, bool | |
431 | keep_index_consistent, | |
432 | optional_yield y, const | |
433 | DoutPrefixProvider *dpp) override; | |
434 | virtual RGWAccessControlPolicy& get_acl(void) override { return next->get_acl(); } | |
435 | virtual int set_acl(const DoutPrefixProvider* dpp, RGWAccessControlPolicy& acl, | |
436 | optional_yield y) override; | |
437 | ||
438 | virtual void set_owner(rgw::sal::User* _owner) override { next->set_owner(_owner); } | |
439 | virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y, | |
440 | bool get_stats = false) override; | |
441 | virtual int read_stats(const DoutPrefixProvider *dpp, | |
442 | const bucket_index_layout_generation& idx_layout, | |
443 | int shard_id, std::string* bucket_ver, std::string* master_ver, | |
444 | std::map<RGWObjCategory, RGWStorageStats>& stats, | |
445 | std::string* max_marker = nullptr, | |
446 | bool* syncstopped = nullptr) override; | |
447 | virtual int read_stats_async(const DoutPrefixProvider *dpp, | |
448 | const bucket_index_layout_generation& idx_layout, | |
449 | int shard_id, RGWGetBucketStats_CB* ctx) override; | |
450 | virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) override; | |
451 | virtual int update_container_stats(const DoutPrefixProvider* dpp) override; | |
452 | virtual int check_bucket_shards(const DoutPrefixProvider* dpp) override; | |
453 | virtual int chown(const DoutPrefixProvider* dpp, User& new_user, | |
454 | optional_yield y) override; | |
455 | virtual int put_info(const DoutPrefixProvider* dpp, bool exclusive, | |
456 | ceph::real_time mtime) override; | |
457 | virtual bool is_owner(User* user) override; | |
458 | virtual User* get_owner(void) override { return user; } | |
459 | virtual ACLOwner get_acl_owner(void) override { return next->get_acl_owner(); } | |
460 | virtual int check_empty(const DoutPrefixProvider* dpp, optional_yield y) override; | |
461 | virtual int check_quota(const DoutPrefixProvider *dpp, RGWQuota& quota, | |
462 | uint64_t obj_size, optional_yield y, | |
463 | bool check_size_only = false) override; | |
464 | virtual int merge_and_store_attrs(const DoutPrefixProvider* dpp, | |
465 | Attrs& new_attrs, optional_yield y) override; | |
466 | virtual int try_refresh_info(const DoutPrefixProvider* dpp, | |
467 | ceph::real_time* pmtime) override; | |
468 | virtual int read_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, | |
469 | uint64_t end_epoch, uint32_t max_entries, | |
470 | bool* is_truncated, RGWUsageIter& usage_iter, | |
471 | std::map<rgw_user_bucket, | |
472 | rgw_usage_log_entry>& usage) override; | |
473 | virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, | |
474 | uint64_t end_epoch) override; | |
475 | virtual int remove_objs_from_index(const DoutPrefixProvider *dpp, | |
476 | std::list<rgw_obj_index_key>& | |
477 | objs_to_unlink) override; | |
478 | virtual int check_index(const DoutPrefixProvider *dpp, | |
479 | std::map<RGWObjCategory, RGWStorageStats>& | |
480 | existing_stats, | |
481 | std::map<RGWObjCategory, RGWStorageStats>& | |
482 | calculated_stats) override; | |
483 | virtual int rebuild_index(const DoutPrefixProvider *dpp) override; | |
484 | virtual int set_tag_timeout(const DoutPrefixProvider *dpp, uint64_t timeout) override; | |
485 | virtual int purge_instance(const DoutPrefixProvider* dpp) override; | |
486 | virtual bool empty() const override { return next->empty(); } | |
487 | virtual const std::string& get_name() const override { return next->get_name(); } | |
488 | virtual const std::string& get_tenant() const override { return next->get_tenant(); } | |
489 | virtual const std::string& get_marker() const override { return next->get_marker(); } | |
490 | virtual const std::string& get_bucket_id() const override { return next->get_bucket_id(); } | |
491 | virtual size_t get_size() const override { return next->get_size(); } | |
492 | virtual size_t get_size_rounded() const override { return next->get_size_rounded(); } | |
493 | virtual uint64_t get_count() const override { return next->get_count(); } | |
494 | virtual rgw_placement_rule& get_placement_rule() override { return next->get_placement_rule(); } | |
495 | virtual ceph::real_time& get_creation_time() override { return next->get_creation_time(); } | |
496 | virtual ceph::real_time& get_modification_time() override { return next->get_modification_time(); } | |
497 | virtual obj_version& get_version() override { return next->get_version(); } | |
498 | virtual void set_version(obj_version &ver) override { next->set_version(ver); } | |
499 | virtual bool versioned() override { return next->versioned(); } | |
500 | virtual bool versioning_enabled() override { return next->versioning_enabled(); } | |
501 | ||
502 | virtual std::unique_ptr<Bucket> clone() override { | |
503 | std::unique_ptr<Bucket> nb = next->clone(); | |
504 | return std::make_unique<FilterBucket>(std::move(nb), user); | |
505 | } | |
506 | ||
507 | virtual std::unique_ptr<MultipartUpload> get_multipart_upload( | |
508 | const std::string& oid, | |
509 | std::optional<std::string> upload_id=std::nullopt, | |
510 | ACLOwner owner={}, ceph::real_time mtime=real_clock::now()) override; | |
511 | virtual int list_multiparts(const DoutPrefixProvider *dpp, | |
512 | const std::string& prefix, | |
513 | std::string& marker, | |
514 | const std::string& delim, | |
515 | const int& max_uploads, | |
516 | std::vector<std::unique_ptr<MultipartUpload>>& uploads, | |
517 | std::map<std::string, bool> *common_prefixes, | |
518 | bool *is_truncated) override; | |
519 | virtual int abort_multiparts(const DoutPrefixProvider* dpp, | |
520 | CephContext* cct) override; | |
521 | ||
522 | int read_topics(rgw_pubsub_bucket_topics& notifications, RGWObjVersionTracker* objv_tracker, | |
523 | optional_yield y, const DoutPrefixProvider *dpp) override { | |
524 | return next->read_topics(notifications, objv_tracker, y, dpp); | |
525 | } | |
526 | int write_topics(const rgw_pubsub_bucket_topics& notifications, RGWObjVersionTracker* obj_tracker, | |
527 | optional_yield y, const DoutPrefixProvider *dpp) override { | |
528 | return next->write_topics(notifications, obj_tracker, y, dpp); | |
529 | } | |
530 | int remove_topics(RGWObjVersionTracker* objv_tracker, | |
531 | optional_yield y, const DoutPrefixProvider *dpp) override { | |
532 | return next->remove_topics(objv_tracker, y, dpp); | |
533 | } | |
534 | ||
535 | virtual rgw_bucket& get_key() override { return next->get_key(); } | |
536 | virtual RGWBucketInfo& get_info() override { return next->get_info(); } | |
537 | ||
538 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
539 | ||
540 | virtual bool operator==(const Bucket& b) const override { return next->operator==(b); } | |
541 | virtual bool operator!=(const Bucket& b) const override { return next->operator!=(b); } | |
542 | ||
543 | friend class BucketList; | |
544 | ||
545 | /* Internal to Filters */ | |
546 | Bucket* get_next() { return next.get(); } | |
547 | }; | |
548 | ||
549 | class FilterObject : public Object { | |
550 | protected: | |
551 | std::unique_ptr<Object> next; | |
552 | private: | |
553 | Bucket* bucket{nullptr}; | |
554 | ||
555 | public: | |
556 | ||
557 | struct FilterReadOp : ReadOp { | |
558 | std::unique_ptr<ReadOp> next; | |
559 | ||
560 | FilterReadOp(std::unique_ptr<ReadOp> _next) : next(std::move(_next)) {} | |
561 | virtual ~FilterReadOp() = default; | |
562 | ||
563 | virtual int prepare(optional_yield y, const DoutPrefixProvider* dpp) override; | |
564 | virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, | |
565 | const DoutPrefixProvider* dpp) override; | |
566 | virtual int iterate(const DoutPrefixProvider* dpp, int64_t ofs, int64_t end, | |
567 | RGWGetDataCB* cb, optional_yield y) override; | |
568 | virtual int get_attr(const DoutPrefixProvider* dpp, const char* name, | |
569 | bufferlist& dest, optional_yield y) override; | |
570 | }; | |
571 | ||
572 | struct FilterDeleteOp : DeleteOp { | |
573 | std::unique_ptr<DeleteOp> next; | |
574 | ||
575 | FilterDeleteOp(std::unique_ptr<DeleteOp> _next) : next(std::move(_next)) {} | |
576 | virtual ~FilterDeleteOp() = default; | |
577 | ||
578 | virtual int delete_obj(const DoutPrefixProvider* dpp, optional_yield y) override; | |
579 | }; | |
580 | ||
581 | FilterObject(std::unique_ptr<Object> _next) : next(std::move(_next)) {} | |
582 | FilterObject(std::unique_ptr<Object> _next, Bucket* _bucket) : | |
583 | next(std::move(_next)), bucket(_bucket) {} | |
584 | FilterObject(FilterObject& _o) { | |
585 | next = _o.next->clone(); | |
586 | bucket = _o.bucket; | |
587 | } | |
588 | virtual ~FilterObject() = default; | |
589 | ||
590 | virtual int delete_object(const DoutPrefixProvider* dpp, | |
591 | optional_yield y, | |
592 | bool prevent_versioning = false) override; | |
593 | virtual int delete_obj_aio(const DoutPrefixProvider* dpp, RGWObjState* astate, | |
594 | Completions* aio, | |
595 | bool keep_index_consistent, optional_yield y) override; | |
596 | virtual int copy_object(User* user, | |
597 | req_info* info, const rgw_zone_id& source_zone, | |
598 | rgw::sal::Object* dest_object, rgw::sal::Bucket* dest_bucket, | |
599 | rgw::sal::Bucket* src_bucket, | |
600 | const rgw_placement_rule& dest_placement, | |
601 | ceph::real_time* src_mtime, ceph::real_time* mtime, | |
602 | const ceph::real_time* mod_ptr, const ceph::real_time* unmod_ptr, | |
603 | bool high_precision_time, | |
604 | const char* if_match, const char* if_nomatch, | |
605 | AttrsMod attrs_mod, bool copy_if_newer, Attrs& attrs, | |
606 | RGWObjCategory category, uint64_t olh_epoch, | |
607 | boost::optional<ceph::real_time> delete_at, | |
608 | std::string* version_id, std::string* tag, std::string* etag, | |
609 | void (*progress_cb)(off_t, void *), void* progress_data, | |
610 | const DoutPrefixProvider* dpp, optional_yield y) override; | |
611 | virtual RGWAccessControlPolicy& get_acl(void) override; | |
612 | virtual int set_acl(const RGWAccessControlPolicy& acl) override { return next->set_acl(acl); } | |
613 | virtual void set_atomic() override { return next->set_atomic(); } | |
614 | virtual bool is_atomic() override { return next->is_atomic(); } | |
615 | virtual void set_prefetch_data() override { return next->set_prefetch_data(); } | |
616 | virtual bool is_prefetch_data() override { return next->is_prefetch_data(); } | |
617 | virtual void set_compressed() override { return next->set_compressed(); } | |
618 | virtual bool is_compressed() override { return next->is_compressed(); } | |
619 | virtual void invalidate() override { return next->invalidate(); } | |
620 | virtual bool empty() const override { return next->empty(); } | |
621 | virtual const std::string &get_name() const override { return next->get_name(); } | |
622 | ||
623 | virtual int get_obj_state(const DoutPrefixProvider* dpp, RGWObjState **state, | |
624 | optional_yield y, bool follow_olh = true) override; | |
625 | virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, | |
626 | Attrs* delattrs, optional_yield y) override; | |
627 | virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, | |
628 | rgw_obj* target_obj = NULL) override; | |
629 | virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, | |
630 | optional_yield y, const DoutPrefixProvider* dpp) override; | |
631 | virtual int delete_obj_attrs(const DoutPrefixProvider* dpp, const char* attr_name, | |
632 | optional_yield y) override; | |
633 | virtual bool is_expired() override; | |
634 | virtual void gen_rand_obj_instance_name() override; | |
635 | virtual std::unique_ptr<MPSerializer> get_serializer(const DoutPrefixProvider *dpp, | |
636 | const std::string& lock_name) override; | |
637 | virtual int transition(Bucket* bucket, | |
638 | const rgw_placement_rule& placement_rule, | |
639 | const real_time& mtime, | |
640 | uint64_t olh_epoch, | |
641 | const DoutPrefixProvider* dpp, | |
642 | optional_yield y) override; | |
643 | virtual int transition_to_cloud(Bucket* bucket, | |
644 | rgw::sal::PlacementTier* tier, | |
645 | rgw_bucket_dir_entry& o, | |
646 | std::set<std::string>& cloud_targets, | |
647 | CephContext* cct, | |
648 | bool update_object, | |
649 | const DoutPrefixProvider* dpp, | |
650 | optional_yield y) override; | |
651 | virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override; | |
652 | virtual int dump_obj_layout(const DoutPrefixProvider *dpp, optional_yield y, | |
653 | Formatter* f) override; | |
654 | ||
655 | virtual Attrs& get_attrs(void) override { return next->get_attrs(); }; | |
656 | virtual const Attrs& get_attrs(void) const override { return next->get_attrs(); }; | |
657 | virtual int set_attrs(Attrs a) override { return next->set_attrs(a); }; | |
658 | virtual bool has_attrs(void) override { return next->has_attrs(); }; | |
659 | virtual ceph::real_time get_mtime(void) const override { return next->get_mtime(); }; | |
660 | virtual uint64_t get_obj_size(void) const override { return next->get_obj_size(); }; | |
661 | virtual Bucket* get_bucket(void) const override { return bucket; }; | |
662 | virtual void set_bucket(Bucket* b) override; | |
663 | virtual std::string get_hash_source(void) override { return next->get_hash_source(); }; | |
664 | virtual void set_hash_source(std::string s) override { return next->set_hash_source(s); }; | |
665 | virtual std::string get_oid(void) const override { return next->get_oid(); }; | |
666 | virtual bool get_delete_marker(void) override { return next->get_delete_marker(); }; | |
667 | virtual bool get_in_extra_data(void) override { return next->get_in_extra_data(); }; | |
668 | virtual void set_in_extra_data(bool i) override { return next->set_in_extra_data(i); }; | |
669 | int range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end) { | |
670 | return next->range_to_ofs(obj_size, ofs, end); | |
671 | }; | |
672 | virtual void set_obj_size(uint64_t s) override { return next->set_obj_size(s); }; | |
673 | virtual void set_name(const std::string& n) override { return next->set_name(n); }; | |
674 | virtual void set_key(const rgw_obj_key& k) override { return next->set_key(k); }; | |
675 | virtual rgw_obj get_obj(void) const override { return next->get_obj(); }; | |
676 | virtual rgw_obj_key& get_key() override { return next->get_key(); } | |
677 | virtual void set_instance(const std::string &i) override { return next->set_instance(i); } | |
678 | virtual const std::string &get_instance() const override { return next->get_instance(); } | |
679 | virtual bool have_instance(void) override { return next->have_instance(); } | |
680 | virtual void clear_instance() override { return next->clear_instance(); } | |
681 | ||
682 | virtual int swift_versioning_restore(bool& restored, /* out */ | |
683 | const DoutPrefixProvider* dpp) override; | |
684 | virtual int swift_versioning_copy(const DoutPrefixProvider* dpp, | |
685 | optional_yield y) override; | |
686 | ||
687 | virtual std::unique_ptr<ReadOp> get_read_op() override; | |
688 | virtual std::unique_ptr<DeleteOp> get_delete_op() override; | |
689 | ||
690 | virtual int omap_get_vals(const DoutPrefixProvider *dpp, const std::string& marker, | |
691 | uint64_t count, std::map<std::string, bufferlist>* m, | |
692 | bool* pmore, optional_yield y) override; | |
693 | virtual int omap_get_all(const DoutPrefixProvider *dpp, | |
694 | std::map<std::string, bufferlist>* m, | |
695 | optional_yield y) override; | |
696 | virtual int omap_get_vals_by_keys(const DoutPrefixProvider *dpp, | |
697 | const std::string& oid, | |
698 | const std::set<std::string>& keys, | |
699 | Attrs* vals) override; | |
700 | virtual int omap_set_val_by_key(const DoutPrefixProvider *dpp, | |
701 | const std::string& key, bufferlist& val, | |
702 | bool must_exist, optional_yield y) override; | |
703 | virtual int chown(User& new_user, const DoutPrefixProvider* dpp, | |
704 | optional_yield y) override; | |
705 | ||
706 | virtual std::unique_ptr<Object> clone() override { | |
707 | return std::make_unique<FilterObject>(*this); | |
708 | } | |
709 | ||
710 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
711 | ||
712 | /* Internal to Filters */ | |
713 | Object* get_next() { return next.get(); } | |
714 | }; | |
715 | ||
716 | class FilterMultipartPart : public MultipartPart { | |
717 | protected: | |
718 | std::unique_ptr<MultipartPart> next; | |
719 | ||
720 | public: | |
721 | FilterMultipartPart(std::unique_ptr<MultipartPart> _next) : next(std::move(_next)) {} | |
722 | virtual ~FilterMultipartPart() = default; | |
723 | ||
724 | virtual uint32_t get_num() override { return next->get_num(); } | |
725 | virtual uint64_t get_size() override { return next->get_size(); } | |
726 | virtual const std::string& get_etag() override { return next->get_etag(); } | |
727 | virtual ceph::real_time& get_mtime() override { return next->get_mtime(); } | |
728 | }; | |
729 | ||
730 | class FilterMultipartUpload : public MultipartUpload { | |
731 | protected: | |
732 | std::unique_ptr<MultipartUpload> next; | |
733 | Bucket* bucket; | |
734 | std::map<uint32_t, std::unique_ptr<MultipartPart>> parts; | |
735 | ||
736 | public: | |
737 | FilterMultipartUpload(std::unique_ptr<MultipartUpload> _next, Bucket* _b) : | |
738 | next(std::move(_next)), bucket(_b) {} | |
739 | virtual ~FilterMultipartUpload() = default; | |
740 | ||
741 | virtual const std::string& get_meta() const override { return next->get_meta(); } | |
742 | virtual const std::string& get_key() const override { return next->get_key(); } | |
743 | virtual const std::string& get_upload_id() const override { return next->get_upload_id(); } | |
744 | virtual const ACLOwner& get_owner() const override { return next->get_owner(); } | |
745 | virtual ceph::real_time& get_mtime() override { return next->get_mtime(); } | |
746 | ||
747 | virtual std::map<uint32_t, std::unique_ptr<MultipartPart>>& get_parts() override { return parts; } | |
748 | ||
749 | virtual const jspan_context& get_trace() override { return next->get_trace(); } | |
750 | ||
751 | virtual std::unique_ptr<rgw::sal::Object> get_meta_obj() override; | |
752 | ||
753 | virtual int init(const DoutPrefixProvider* dpp, optional_yield y, ACLOwner& owner, rgw_placement_rule& dest_placement, rgw::sal::Attrs& attrs) override; | |
754 | virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct, | |
755 | int num_parts, int marker, | |
756 | int* next_marker, bool* truncated, | |
757 | bool assume_unsorted = false) override; | |
758 | virtual int abort(const DoutPrefixProvider* dpp, CephContext* cct) override; | |
759 | virtual int complete(const DoutPrefixProvider* dpp, | |
760 | optional_yield y, CephContext* cct, | |
761 | std::map<int, std::string>& part_etags, | |
762 | std::list<rgw_obj_index_key>& remove_objs, | |
763 | uint64_t& accounted_size, bool& compressed, | |
764 | RGWCompressionInfo& cs_info, off_t& ofs, | |
765 | std::string& tag, ACLOwner& owner, | |
766 | uint64_t olh_epoch, | |
767 | rgw::sal::Object* target_obj) override; | |
768 | ||
769 | virtual int get_info(const DoutPrefixProvider *dpp, optional_yield y, | |
770 | rgw_placement_rule** rule, | |
771 | rgw::sal::Attrs* attrs = nullptr) override; | |
772 | ||
773 | virtual std::unique_ptr<Writer> get_writer(const DoutPrefixProvider *dpp, | |
774 | optional_yield y, | |
775 | rgw::sal::Object* obj, | |
776 | const rgw_user& owner, | |
777 | const rgw_placement_rule *ptail_placement_rule, | |
778 | uint64_t part_num, | |
779 | const std::string& part_num_str) override; | |
780 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
781 | }; | |
782 | ||
783 | class FilterMPSerializer : public MPSerializer { | |
784 | protected: | |
785 | std::unique_ptr<MPSerializer> next; | |
786 | ||
787 | public: | |
788 | FilterMPSerializer(std::unique_ptr<MPSerializer> _next) : next(std::move(_next)) {} | |
789 | virtual ~FilterMPSerializer() = default; | |
790 | ||
791 | virtual int try_lock(const DoutPrefixProvider *dpp, utime_t dur, optional_yield y) override; | |
792 | virtual int unlock() override { return next->unlock(); } | |
793 | virtual void clear_locked() override { next->clear_locked(); } | |
794 | virtual bool is_locked() override { return next->is_locked(); } | |
795 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
796 | }; | |
797 | ||
798 | class FilterLCSerializer : public LCSerializer { | |
799 | protected: | |
800 | std::unique_ptr<LCSerializer> next; | |
801 | ||
802 | public: | |
803 | FilterLCSerializer(std::unique_ptr<LCSerializer> _next) : next(std::move(_next)) {} | |
804 | virtual ~FilterLCSerializer() = default; | |
805 | ||
806 | virtual int try_lock(const DoutPrefixProvider *dpp, utime_t dur, optional_yield y) override; | |
807 | virtual int unlock() override { return next->unlock(); } | |
808 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
809 | }; | |
810 | ||
811 | class FilterLifecycle : public Lifecycle { | |
812 | protected: | |
813 | std::unique_ptr<Lifecycle> next; | |
814 | ||
815 | public: | |
816 | struct FilterLCHead : LCHead { | |
817 | std::unique_ptr<LCHead> next; | |
818 | ||
819 | FilterLCHead(std::unique_ptr<LCHead> _next) : next(std::move(_next)) {} | |
820 | virtual ~FilterLCHead() = default; | |
821 | ||
822 | virtual time_t& get_start_date() override { return next->get_start_date(); } | |
823 | virtual void set_start_date(time_t t) override { next->set_start_date(t); } | |
824 | virtual std::string& get_marker() override { return next->get_marker(); } | |
825 | virtual void set_marker(const std::string& m) override { next->set_marker(m); } | |
826 | virtual time_t& get_shard_rollover_date() override { return next->get_shard_rollover_date(); } | |
827 | virtual void set_shard_rollover_date(time_t t) override { next->set_shard_rollover_date(t); } | |
828 | }; | |
829 | ||
830 | struct FilterLCEntry : LCEntry { | |
831 | std::unique_ptr<LCEntry> next; | |
832 | ||
833 | FilterLCEntry(std::unique_ptr<LCEntry> _next) : next(std::move(_next)) {} | |
834 | virtual ~FilterLCEntry() = default; | |
835 | ||
836 | virtual std::string& get_bucket() override { return next->get_bucket(); } | |
837 | virtual void set_bucket(const std::string& b) override { next->set_bucket(b); } | |
838 | virtual std::string& get_oid() override { return next->get_oid(); } | |
839 | virtual void set_oid(const std::string& o) override { next->set_oid(o); } | |
840 | virtual uint64_t get_start_time() override { return next->get_start_time(); } | |
841 | virtual void set_start_time(uint64_t t) override { next->set_start_time(t); } | |
842 | virtual uint32_t get_status() override { return next->get_status(); } | |
843 | virtual void set_status(uint32_t s) override { next->set_status(s); } | |
844 | virtual void print(std::ostream& out) const override { return next->print(out); } | |
845 | }; | |
846 | ||
847 | FilterLifecycle(std::unique_ptr<Lifecycle> _next) : next(std::move(_next)) {} | |
848 | virtual ~FilterLifecycle() = default; | |
849 | ||
850 | virtual std::unique_ptr<LCEntry> get_entry() override; | |
851 | virtual int get_entry(const std::string& oid, const std::string& marker, | |
852 | std::unique_ptr<LCEntry>* entry) override; | |
853 | virtual int get_next_entry(const std::string& oid, const std::string& marker, | |
854 | std::unique_ptr<LCEntry>* entry) override; | |
855 | virtual int set_entry(const std::string& oid, LCEntry& entry) override; | |
856 | virtual int list_entries(const std::string& oid, const std::string& marker, | |
857 | uint32_t max_entries, | |
858 | std::vector<std::unique_ptr<LCEntry>>& entries) override; | |
859 | virtual int rm_entry(const std::string& oid, LCEntry& entry) override; | |
860 | virtual int get_head(const std::string& oid, std::unique_ptr<LCHead>* head) override; | |
861 | virtual int put_head(const std::string& oid, LCHead& head) override; | |
862 | virtual std::unique_ptr<LCSerializer> get_serializer(const std::string& lock_name, | |
863 | const std::string& oid, | |
864 | const std::string& cookie) override; | |
865 | }; | |
866 | ||
867 | class FilterNotification : public Notification { | |
868 | protected: | |
869 | std::unique_ptr<Notification> next; | |
870 | ||
871 | public: | |
872 | FilterNotification(std::unique_ptr<Notification> _next) : next(std::move(_next)) {} | |
873 | ||
874 | virtual ~FilterNotification() = default; | |
875 | ||
876 | virtual int publish_reserve(const DoutPrefixProvider *dpp, | |
877 | RGWObjTags* obj_tags = nullptr) override; | |
878 | virtual int publish_commit(const DoutPrefixProvider* dpp, uint64_t size, | |
879 | const ceph::real_time& mtime, | |
880 | const std::string& etag, | |
881 | const std::string& version) override; | |
882 | }; | |
883 | ||
884 | class FilterWriter : public Writer { | |
885 | protected: | |
886 | std::unique_ptr<Writer> next; | |
887 | Object* obj; | |
888 | public: | |
889 | FilterWriter(std::unique_ptr<Writer> _next, Object* _obj) : | |
890 | next(std::move(_next)), obj(_obj) {} | |
891 | virtual ~FilterWriter() = default; | |
892 | ||
893 | virtual int prepare(optional_yield y) { return next->prepare(y); } | |
894 | virtual int process(bufferlist&& data, uint64_t offset) override; | |
895 | virtual int complete(size_t accounted_size, const std::string& etag, | |
896 | ceph::real_time *mtime, ceph::real_time set_mtime, | |
897 | std::map<std::string, bufferlist>& attrs, | |
898 | ceph::real_time delete_at, | |
899 | const char *if_match, const char *if_nomatch, | |
900 | const std::string *user_data, | |
901 | rgw_zone_set *zones_trace, bool *canceled, | |
902 | optional_yield y) override; | |
903 | }; | |
904 | ||
905 | class FilterLuaManager : public LuaManager { | |
906 | protected: | |
907 | std::unique_ptr<LuaManager> next; | |
908 | ||
909 | public: | |
910 | FilterLuaManager(std::unique_ptr<LuaManager> _next) : next(std::move(_next)) {} | |
911 | virtual ~FilterLuaManager() = default; | |
912 | ||
913 | virtual int get_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, std::string& script) override; | |
914 | virtual int put_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, const std::string& script) override; | |
915 | virtual int del_script(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key) override; | |
916 | virtual int add_package(const DoutPrefixProvider* dpp, optional_yield y, const std::string& package_name) override; | |
917 | virtual int remove_package(const DoutPrefixProvider* dpp, optional_yield y, const std::string& package_name) override; | |
918 | virtual int list_packages(const DoutPrefixProvider* dpp, optional_yield y, rgw::lua::packages_t& packages) override; | |
919 | }; | |
920 | ||
921 | } } // namespace rgw::sal |