]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_bucket_sobj.h
update source to Ceph Pacific 16.2.2
[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) 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
65 int read_bucket_stats(const RGWBucketInfo& bucket_info,
66 RGWBucketEnt *ent,
67 optional_yield y);
68
69 public:
70 struct Svc {
71 RGWSI_Bucket_SObj *bucket{nullptr};
72 RGWSI_BucketIndex *bi{nullptr};
73 RGWSI_Zone *zone{nullptr};
74 RGWSI_SysObj *sysobj{nullptr};
75 RGWSI_SysObj_Cache *cache{nullptr};
76 RGWSI_Meta *meta{nullptr};
77 RGWSI_MetaBackend *meta_be{nullptr};
78 RGWSI_SyncModules *sync_modules{nullptr};
79 RGWSI_Bucket_Sync *bucket_sync{nullptr};
80 } svc;
81
82 RGWSI_Bucket_SObj(CephContext *cct);
83 ~RGWSI_Bucket_SObj();
84
85 RGWSI_Bucket_BE_Handler& get_ep_be_handler() override {
86 return ep_be_handler;
87 }
88
89 RGWSI_BucketInstance_BE_Handler& get_bi_be_handler() override {
90 return bi_be_handler;
91 }
92
93 void init(RGWSI_Zone *_zone_svc,
94 RGWSI_SysObj *_sysobj_svc,
95 RGWSI_SysObj_Cache *_cache_svc,
96 RGWSI_BucketIndex *_bi,
97 RGWSI_Meta *_meta_svc,
98 RGWSI_MetaBackend *_meta_be_svc,
99 RGWSI_SyncModules *_sync_modules_svc,
100 RGWSI_Bucket_Sync *_bucket_sync_svc);
101
102
103 int read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
104 const string& key,
105 RGWBucketEntryPoint *entry_point,
106 RGWObjVersionTracker *objv_tracker,
107 real_time *pmtime,
108 map<string, bufferlist> *pattrs,
109 optional_yield y,
110 rgw_cache_entry_info *cache_info = nullptr,
111 boost::optional<obj_version> refresh_version = boost::none) override;
112
113 int store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
114 const string& key,
115 RGWBucketEntryPoint& info,
116 bool exclusive,
117 real_time mtime,
118 map<string, bufferlist> *pattrs,
119 RGWObjVersionTracker *objv_tracker,
120 optional_yield y) override;
121
122 int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
123 const string& key,
124 RGWObjVersionTracker *objv_tracker,
125 optional_yield y) override;
126
127 int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
128 const string& key,
129 RGWBucketInfo *info,
130 real_time *pmtime,
131 map<string, bufferlist> *pattrs,
132 optional_yield y,
133 rgw_cache_entry_info *cache_info = nullptr,
134 boost::optional<obj_version> refresh_version = boost::none) override;
135
136 int read_bucket_info(RGWSI_Bucket_X_Ctx& ep_ctx,
137 const rgw_bucket& bucket,
138 RGWBucketInfo *info,
139 real_time *pmtime,
140 map<string, bufferlist> *pattrs,
141 boost::optional<obj_version> refresh_version,
142 optional_yield y) override;
143
144 int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
145 const string& key,
146 RGWBucketInfo& info,
147 std::optional<RGWBucketInfo *> orig_info, /* nullopt: orig_info was not fetched,
148 nullptr: orig_info was not found (new bucket instance */
149 bool exclusive,
150 real_time mtime,
151 map<string, bufferlist> *pattrs,
152 optional_yield y) override;
153
154 int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
155 const string& key,
156 const RGWBucketInfo& bucket_info,
157 RGWObjVersionTracker *objv_tracker,
158 optional_yield y) override;
159
160 int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx,
161 const rgw_bucket& bucket,
162 RGWBucketEnt *ent,
163 optional_yield y) override;
164
165 int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx,
166 map<string, RGWBucketEnt>& m,
167 optional_yield y) override;
168 };
169