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 "svc_meta_be.h"
22 #include "rgw/rgw_service.h"
25 class RGWGetUserStats_CB
;
27 class RGWSI_User
: public RGWServiceInstance
30 RGWSI_User(CephContext
*cct
);
31 virtual ~RGWSI_User();
33 static std::string
get_meta_key(const rgw_user
& user
) {
37 static rgw_user
user_from_meta_key(const std::string
& key
) {
41 virtual RGWSI_MetaBackend_Handler
*get_be_handler() = 0;
43 /* base svc_user interfaces */
45 virtual int read_user_info(RGWSI_MetaBackend::Context
*ctx
,
48 RGWObjVersionTracker
* const objv_tracker
,
49 real_time
* const pmtime
,
50 rgw_cache_entry_info
* const cache_info
,
51 std::map
<std::string
, bufferlist
> * const pattrs
,
53 const DoutPrefixProvider
*dpp
) = 0;
55 virtual int store_user_info(RGWSI_MetaBackend::Context
*ctx
,
56 const RGWUserInfo
& info
,
57 RGWUserInfo
*old_info
,
58 RGWObjVersionTracker
*objv_tracker
,
59 const real_time
& mtime
,
61 std::map
<std::string
, bufferlist
> *attrs
,
63 const DoutPrefixProvider
*dpp
) = 0;
65 virtual int remove_user_info(RGWSI_MetaBackend::Context
*ctx
,
66 const RGWUserInfo
& info
,
67 RGWObjVersionTracker
*objv_tracker
,
69 const DoutPrefixProvider
*dpp
) = 0;
71 virtual int get_user_info_by_email(RGWSI_MetaBackend::Context
*ctx
,
72 const std::string
& email
, RGWUserInfo
*info
,
73 RGWObjVersionTracker
*objv_tracker
,
76 const DoutPrefixProvider
*dpp
) = 0;
77 virtual int get_user_info_by_swift(RGWSI_MetaBackend::Context
*ctx
,
78 const std::string
& swift_name
,
79 RGWUserInfo
*info
, /* out */
80 RGWObjVersionTracker
* const objv_tracker
,
81 real_time
* const pmtime
,
83 const DoutPrefixProvider
*dpp
) = 0;
84 virtual int get_user_info_by_access_key(RGWSI_MetaBackend::Context
*ctx
,
85 const std::string
& access_key
,
87 RGWObjVersionTracker
* objv_tracker
,
90 const DoutPrefixProvider
*dpp
) = 0;
92 virtual int add_bucket(const DoutPrefixProvider
*dpp
,
93 RGWSI_MetaBackend::Context
*ctx
,
95 const rgw_bucket
& bucket
,
96 ceph::real_time creation_time
,
97 optional_yield y
) = 0;
98 virtual int remove_bucket(const DoutPrefixProvider
*dpp
,
99 RGWSI_MetaBackend::Context
*ctx
,
100 const rgw_user
& user
,
101 const rgw_bucket
& _bucket
, optional_yield
) = 0;
102 virtual int list_buckets(const DoutPrefixProvider
*dpp
,
103 RGWSI_MetaBackend::Context
*ctx
,
104 const rgw_user
& user
,
105 const std::string
& marker
,
106 const std::string
& end_marker
,
108 RGWUserBuckets
*buckets
,
110 optional_yield y
) = 0;
112 virtual int flush_bucket_stats(const DoutPrefixProvider
*dpp
,
113 RGWSI_MetaBackend::Context
*ctx
,
114 const rgw_user
& user
,
115 const RGWBucketEnt
& ent
, optional_yield y
) = 0;
116 virtual int complete_flush_stats(const DoutPrefixProvider
*dpp
, RGWSI_MetaBackend::Context
*ctx
,
117 const rgw_user
& user
, optional_yield y
) = 0;
118 virtual int reset_bucket_stats(const DoutPrefixProvider
*dpp
,
119 RGWSI_MetaBackend::Context
*ctx
,
120 const rgw_user
& user
,
121 optional_yield y
) = 0;
122 virtual int read_stats(const DoutPrefixProvider
*dpp
,
123 RGWSI_MetaBackend::Context
*ctx
,
124 const rgw_user
& user
, RGWStorageStats
*stats
,
125 ceph::real_time
*last_stats_sync
, /* last time a full stats sync completed */
126 ceph::real_time
*last_stats_update
,
127 optional_yield y
) = 0; /* last time a stats update was done */
129 virtual int read_stats_async(const DoutPrefixProvider
*dpp
, RGWSI_MetaBackend::Context
*ctx
,
130 const rgw_user
& user
, RGWGetUserStats_CB
*cb
) = 0;