]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_bucket_sobj.h
import ceph pacific 16.2.5
[ceph.git] / ceph / src / rgw / services / svc_bucket_sobj.h
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
20 #include "rgw/rgw_service.h"
21
22 #include "svc_meta_be.h"
23 #include "svc_bucket_types.h"
24 #include "svc_bucket.h"
25
26 class RGWSI_Zone;
27 class RGWSI_SysObj;
28 class RGWSI_SysObj_Cache;
29 class RGWSI_Meta;
30 class RGWSI_SyncModules;
31 class RGWSI_Bucket_Sync;
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;
43 map<string, bufferlist> attrs;
44 };
45
46 using RGWChainedCacheImpl_bucket_info_cache_entry = RGWChainedCacheImpl<bucket_info_cache_entry>;
47 unique_ptr<RGWChainedCacheImpl_bucket_info_cache_entry> binfo_cache;
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
54 int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
55
56 int do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
57 const string& key,
58 RGWBucketInfo *info,
59 real_time *pmtime,
60 map<string, bufferlist> *pattrs,
61 rgw_cache_entry_info *cache_info,
62 boost::optional<obj_version> refresh_version,
63 optional_yield y,
64 const DoutPrefixProvider *dpp);
65
66 int read_bucket_stats(const RGWBucketInfo& bucket_info,
67 RGWBucketEnt *ent,
68 optional_yield y,
69 const DoutPrefixProvider *dpp);
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,
106 const string& key,
107 RGWBucketEntryPoint *entry_point,
108 RGWObjVersionTracker *objv_tracker,
109 real_time *pmtime,
110 map<string, bufferlist> *pattrs,
111 optional_yield y,
112 const DoutPrefixProvider *dpp,
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,
117 const string& key,
118 RGWBucketEntryPoint& info,
119 bool exclusive,
120 real_time mtime,
121 map<string, bufferlist> *pattrs,
122 RGWObjVersionTracker *objv_tracker,
123 optional_yield y,
124 const DoutPrefixProvider *dpp) override;
125
126 int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
127 const string& key,
128 RGWObjVersionTracker *objv_tracker,
129 optional_yield y,
130 const DoutPrefixProvider *dpp) override;
131
132 int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
133 const string& key,
134 RGWBucketInfo *info,
135 real_time *pmtime,
136 map<string, bufferlist> *pattrs,
137 optional_yield y,
138 const DoutPrefixProvider *dpp,
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,
146 map<string, bufferlist> *pattrs,
147 boost::optional<obj_version> refresh_version,
148 optional_yield y,
149 const DoutPrefixProvider *dpp) override;
150
151 int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
152 const string& key,
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,
158 map<string, bufferlist> *pattrs,
159 optional_yield y,
160 const DoutPrefixProvider *dpp) override;
161
162 int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
163 const string& key,
164 const RGWBucketInfo& bucket_info,
165 RGWObjVersionTracker *objv_tracker,
166 optional_yield y,
167 const DoutPrefixProvider *dpp) override;
168
169 int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx,
170 const rgw_bucket& bucket,
171 RGWBucketEnt *ent,
172 optional_yield y,
173 const DoutPrefixProvider *dpp) override;
174
175 int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx,
176 map<string, RGWBucketEnt>& m,
177 optional_yield y,
178 const DoutPrefixProvider *dpp) override;
179 };
180