]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | |
2 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | |
3 | // vim: ts=8 sw=2 smarttab ft=cpp | |
4 | ||
5 | /* | |
6 | * Ceph - scalable distributed file system | |
7 | * | |
8 | * Copyright (C) 2019 Red Hat, Inc. | |
9 | * | |
10 | * This is free software; you can redistribute it and/or | |
11 | * modify it under the terms of the GNU Lesser General Public | |
12 | * License version 2.1, as published by the Free Software | |
13 | * Foundation. See file COPYING. | |
14 | * | |
15 | */ | |
16 | ||
17 | ||
18 | #pragma once | |
19 | ||
1e59de90 | 20 | #include "rgw_service.h" |
9f95a23c TL |
21 | |
22 | #include "svc_meta_be.h" | |
23 | #include "svc_bucket_types.h" | |
24 | #include "svc_bucket.h" | |
1e59de90 | 25 | #include "svc_bucket_sync.h" |
9f95a23c TL |
26 | |
27 | class RGWSI_Zone; | |
28 | class RGWSI_SysObj; | |
29 | class RGWSI_SysObj_Cache; | |
30 | class RGWSI_Meta; | |
31 | class RGWSI_SyncModules; | |
9f95a23c TL |
32 | |
33 | struct rgw_cache_entry_info; | |
34 | ||
35 | template <class T> | |
36 | class RGWChainedCacheImpl; | |
37 | ||
38 | class RGWSI_Bucket_SObj : public RGWSI_Bucket | |
39 | { | |
40 | struct bucket_info_cache_entry { | |
41 | RGWBucketInfo info; | |
42 | real_time mtime; | |
20effc67 | 43 | std::map<std::string, bufferlist> attrs; |
9f95a23c TL |
44 | }; |
45 | ||
46 | using RGWChainedCacheImpl_bucket_info_cache_entry = RGWChainedCacheImpl<bucket_info_cache_entry>; | |
20effc67 | 47 | std::unique_ptr<RGWChainedCacheImpl_bucket_info_cache_entry> binfo_cache; |
9f95a23c TL |
48 | |
49 | RGWSI_Bucket_BE_Handler ep_be_handler; | |
50 | std::unique_ptr<RGWSI_MetaBackend::Module> ep_be_module; | |
51 | RGWSI_BucketInstance_BE_Handler bi_be_handler; | |
52 | std::unique_ptr<RGWSI_MetaBackend::Module> bi_be_module; | |
53 | ||
b3b6e05e | 54 | int do_start(optional_yield, const DoutPrefixProvider *dpp) override; |
9f95a23c TL |
55 | |
56 | int do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, | |
20effc67 | 57 | const std::string& key, |
9f95a23c TL |
58 | RGWBucketInfo *info, |
59 | real_time *pmtime, | |
20effc67 | 60 | std::map<std::string, bufferlist> *pattrs, |
9f95a23c TL |
61 | rgw_cache_entry_info *cache_info, |
62 | boost::optional<obj_version> refresh_version, | |
b3b6e05e TL |
63 | optional_yield y, |
64 | const DoutPrefixProvider *dpp); | |
9f95a23c TL |
65 | |
66 | int read_bucket_stats(const RGWBucketInfo& bucket_info, | |
67 | RGWBucketEnt *ent, | |
b3b6e05e TL |
68 | optional_yield y, |
69 | const DoutPrefixProvider *dpp); | |
9f95a23c TL |
70 | |
71 | public: | |
72 | struct Svc { | |
73 | RGWSI_Bucket_SObj *bucket{nullptr}; | |
74 | RGWSI_BucketIndex *bi{nullptr}; | |
75 | RGWSI_Zone *zone{nullptr}; | |
76 | RGWSI_SysObj *sysobj{nullptr}; | |
77 | RGWSI_SysObj_Cache *cache{nullptr}; | |
78 | RGWSI_Meta *meta{nullptr}; | |
79 | RGWSI_MetaBackend *meta_be{nullptr}; | |
80 | RGWSI_SyncModules *sync_modules{nullptr}; | |
81 | RGWSI_Bucket_Sync *bucket_sync{nullptr}; | |
82 | } svc; | |
83 | ||
84 | RGWSI_Bucket_SObj(CephContext *cct); | |
85 | ~RGWSI_Bucket_SObj(); | |
86 | ||
87 | RGWSI_Bucket_BE_Handler& get_ep_be_handler() override { | |
88 | return ep_be_handler; | |
89 | } | |
90 | ||
91 | RGWSI_BucketInstance_BE_Handler& get_bi_be_handler() override { | |
92 | return bi_be_handler; | |
93 | } | |
94 | ||
95 | void init(RGWSI_Zone *_zone_svc, | |
96 | RGWSI_SysObj *_sysobj_svc, | |
97 | RGWSI_SysObj_Cache *_cache_svc, | |
98 | RGWSI_BucketIndex *_bi, | |
99 | RGWSI_Meta *_meta_svc, | |
100 | RGWSI_MetaBackend *_meta_be_svc, | |
101 | RGWSI_SyncModules *_sync_modules_svc, | |
102 | RGWSI_Bucket_Sync *_bucket_sync_svc); | |
103 | ||
104 | ||
105 | int read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, | |
20effc67 | 106 | const std::string& key, |
9f95a23c TL |
107 | RGWBucketEntryPoint *entry_point, |
108 | RGWObjVersionTracker *objv_tracker, | |
109 | real_time *pmtime, | |
20effc67 | 110 | std::map<std::string, bufferlist> *pattrs, |
9f95a23c | 111 | optional_yield y, |
b3b6e05e | 112 | const DoutPrefixProvider *dpp, |
9f95a23c TL |
113 | rgw_cache_entry_info *cache_info = nullptr, |
114 | boost::optional<obj_version> refresh_version = boost::none) override; | |
115 | ||
116 | int store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, | |
20effc67 | 117 | const std::string& key, |
9f95a23c TL |
118 | RGWBucketEntryPoint& info, |
119 | bool exclusive, | |
120 | real_time mtime, | |
f51cf556 | 121 | const std::map<std::string, bufferlist> *pattrs, |
9f95a23c | 122 | RGWObjVersionTracker *objv_tracker, |
b3b6e05e TL |
123 | optional_yield y, |
124 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
125 | |
126 | int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, | |
20effc67 | 127 | const std::string& key, |
9f95a23c | 128 | RGWObjVersionTracker *objv_tracker, |
b3b6e05e TL |
129 | optional_yield y, |
130 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
131 | |
132 | int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, | |
20effc67 | 133 | const std::string& key, |
9f95a23c TL |
134 | RGWBucketInfo *info, |
135 | real_time *pmtime, | |
20effc67 | 136 | std::map<std::string, bufferlist> *pattrs, |
9f95a23c | 137 | optional_yield y, |
b3b6e05e | 138 | const DoutPrefixProvider *dpp, |
9f95a23c TL |
139 | rgw_cache_entry_info *cache_info = nullptr, |
140 | boost::optional<obj_version> refresh_version = boost::none) override; | |
141 | ||
142 | int read_bucket_info(RGWSI_Bucket_X_Ctx& ep_ctx, | |
143 | const rgw_bucket& bucket, | |
144 | RGWBucketInfo *info, | |
145 | real_time *pmtime, | |
20effc67 | 146 | std::map<std::string, bufferlist> *pattrs, |
9f95a23c | 147 | boost::optional<obj_version> refresh_version, |
b3b6e05e TL |
148 | optional_yield y, |
149 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
150 | |
151 | int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, | |
20effc67 | 152 | const std::string& key, |
9f95a23c TL |
153 | RGWBucketInfo& info, |
154 | std::optional<RGWBucketInfo *> orig_info, /* nullopt: orig_info was not fetched, | |
155 | nullptr: orig_info was not found (new bucket instance */ | |
156 | bool exclusive, | |
157 | real_time mtime, | |
f51cf556 | 158 | const std::map<std::string, bufferlist> *pattrs, |
b3b6e05e TL |
159 | optional_yield y, |
160 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
161 | |
162 | int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, | |
20effc67 | 163 | const std::string& key, |
9f95a23c TL |
164 | const RGWBucketInfo& bucket_info, |
165 | RGWObjVersionTracker *objv_tracker, | |
b3b6e05e TL |
166 | optional_yield y, |
167 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
168 | |
169 | int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx, | |
170 | const rgw_bucket& bucket, | |
171 | RGWBucketEnt *ent, | |
b3b6e05e TL |
172 | optional_yield y, |
173 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
174 | |
175 | int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx, | |
f51cf556 | 176 | std::vector<RGWBucketEnt>& buckets, |
b3b6e05e TL |
177 | optional_yield y, |
178 | const DoutPrefixProvider *dpp) override; | |
9f95a23c TL |
179 | }; |
180 |