2 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
3 // vim: ts=8 sw=2 smarttab ft=cpp
6 * Ceph - scalable distributed file system
8 * Copyright (C) 2019 Red Hat, Inc.
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.
20 #include "rgw/rgw_service.h"
22 #include "svc_meta_be.h"
23 #include "svc_bucket_types.h"
24 #include "svc_bucket.h"
28 class RGWSI_SysObj_Cache
;
30 class RGWSI_SyncModules
;
31 class RGWSI_Bucket_Sync
;
33 struct rgw_cache_entry_info
;
36 class RGWChainedCacheImpl
;
38 class RGWSI_Bucket_SObj
: public RGWSI_Bucket
40 struct bucket_info_cache_entry
{
43 map
<string
, bufferlist
> attrs
;
46 using RGWChainedCacheImpl_bucket_info_cache_entry
= RGWChainedCacheImpl
<bucket_info_cache_entry
>;
47 unique_ptr
<RGWChainedCacheImpl_bucket_info_cache_entry
> binfo_cache
;
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
;
54 int do_start(optional_yield
) override
;
56 int do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx
& ctx
,
60 map
<string
, bufferlist
> *pattrs
,
61 rgw_cache_entry_info
*cache_info
,
62 boost::optional
<obj_version
> refresh_version
,
65 int read_bucket_stats(const RGWBucketInfo
& bucket_info
,
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};
82 RGWSI_Bucket_SObj(CephContext
*cct
);
85 RGWSI_Bucket_BE_Handler
& get_ep_be_handler() override
{
89 RGWSI_BucketInstance_BE_Handler
& get_bi_be_handler() override
{
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
);
103 int read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx
& ctx
,
105 RGWBucketEntryPoint
*entry_point
,
106 RGWObjVersionTracker
*objv_tracker
,
108 map
<string
, bufferlist
> *pattrs
,
110 rgw_cache_entry_info
*cache_info
= nullptr,
111 boost::optional
<obj_version
> refresh_version
= boost::none
) override
;
113 int store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx
& ctx
,
115 RGWBucketEntryPoint
& info
,
118 map
<string
, bufferlist
> *pattrs
,
119 RGWObjVersionTracker
*objv_tracker
,
120 optional_yield y
) override
;
122 int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx
& ctx
,
124 RGWObjVersionTracker
*objv_tracker
,
125 optional_yield y
) override
;
127 int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx
& ctx
,
131 map
<string
, bufferlist
> *pattrs
,
133 rgw_cache_entry_info
*cache_info
= nullptr,
134 boost::optional
<obj_version
> refresh_version
= boost::none
) override
;
136 int read_bucket_info(RGWSI_Bucket_X_Ctx
& ep_ctx
,
137 const rgw_bucket
& bucket
,
140 map
<string
, bufferlist
> *pattrs
,
141 boost::optional
<obj_version
> refresh_version
,
142 optional_yield y
) override
;
144 int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx
& ctx
,
147 std::optional
<RGWBucketInfo
*> orig_info
, /* nullopt: orig_info was not fetched,
148 nullptr: orig_info was not found (new bucket instance */
151 map
<string
, bufferlist
> *pattrs
,
152 optional_yield y
) override
;
154 int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx
& ctx
,
156 const RGWBucketInfo
& bucket_info
,
157 RGWObjVersionTracker
*objv_tracker
,
158 optional_yield y
) override
;
160 int read_bucket_stats(RGWSI_Bucket_X_Ctx
& ctx
,
161 const rgw_bucket
& bucket
,
163 optional_yield y
) override
;
165 int read_buckets_stats(RGWSI_Bucket_X_Ctx
& ctx
,
166 map
<string
, RGWBucketEnt
>& m
,
167 optional_yield y
) override
;