summaryrefslogtreecommitdiffstats
path: root/src/rgw/services/svc_bucket.h
blob: 4a526e4f248010349fb7631ced94db08640ac857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp

/*
 * Ceph - scalable distributed file system
 *
 * Copyright (C) 2019 Red Hat, Inc.
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software
 * Foundation. See file COPYING.
 *
 */


#pragma once

#include "rgw_service.h"

#include "svc_bucket_types.h"

class RGWSI_Bucket : public RGWServiceInstance
{
public:
  RGWSI_Bucket(CephContext *cct) : RGWServiceInstance(cct) {}
  virtual ~RGWSI_Bucket() {}

  static std::string get_entrypoint_meta_key(const rgw_bucket& bucket);
  static std::string get_bi_meta_key(const rgw_bucket& bucket);

  virtual RGWSI_Bucket_BE_Handler& get_ep_be_handler() = 0;
  virtual RGWSI_BucketInstance_BE_Handler& get_bi_be_handler() = 0;

  virtual int read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
                                          const std::string& key,
                                          RGWBucketEntryPoint *entry_point,
                                          RGWObjVersionTracker *objv_tracker,
                                          real_time *pmtime,
                                          std::map<std::string, bufferlist> *pattrs,
                                          optional_yield y,
                                          const DoutPrefixProvider *dpp,
                                          rgw_cache_entry_info *cache_info = nullptr,
                                          boost::optional<obj_version> refresh_version = boost::none) = 0;

  virtual int store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
                                   const std::string& key,
                                   RGWBucketEntryPoint& info,
                                   bool exclusive,
                                   real_time mtime,
                                   std::map<std::string, bufferlist> *pattrs,
                                   RGWObjVersionTracker *objv_tracker,
                                   optional_yield y,
                                   const DoutPrefixProvider *dpp) = 0;

  virtual int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx,
                                    const std::string& key,
                                    RGWObjVersionTracker *objv_tracker,
                                    optional_yield y,
                                    const DoutPrefixProvider *dpp) = 0;

  virtual int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
                                const std::string& key,
                                RGWBucketInfo *info,
                                real_time *pmtime,
                                std::map<std::string, bufferlist> *pattrs,
                                optional_yield y,
                                const DoutPrefixProvider *dpp,
                                rgw_cache_entry_info *cache_info = nullptr,
                                boost::optional<obj_version> refresh_version = boost::none) = 0;

  virtual int read_bucket_info(RGWSI_Bucket_X_Ctx& ep_ctx,
                       const rgw_bucket& bucket,
                       RGWBucketInfo *info,
                       real_time *pmtime,
                       std::map<std::string, bufferlist> *pattrs,
                       boost::optional<obj_version> refresh_version,
                       optional_yield y,
                       const DoutPrefixProvider *dpp) = 0;

  virtual int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
                                 const std::string& key,
                                 RGWBucketInfo& info,
                                 std::optional<RGWBucketInfo *> orig_info, /* nullopt: orig_info was not fetched,
                                                                              nullptr: orig_info was not found (new bucket instance */
                                 bool exclusive,
                                 real_time mtime,
                                 std::map<std::string, bufferlist> *pattrs,
                                 optional_yield y,
                                 const DoutPrefixProvider *dpp) = 0;

  virtual int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
                                  const std::string& key,
				  const RGWBucketInfo& bucket_info,
                                  RGWObjVersionTracker *objv_tracker,
                                  optional_yield y,
                                  const DoutPrefixProvider *dpp) = 0;

  virtual int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx,
                        const rgw_bucket& bucket,
                        RGWBucketEnt *ent,
                        optional_yield y,
                        const DoutPrefixProvider *dpp) = 0;

  virtual int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx,
                                 std::map<std::string, RGWBucketEnt>& m,
                                 optional_yield y,
                                 const DoutPrefixProvider *dpp) = 0;
};