]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
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 "svc_meta_be.h" | |
21 | ||
22 | #include "rgw/rgw_service.h" | |
23 | ||
24 | class RGWUserBuckets; | |
25 | class RGWGetUserStats_CB; | |
26 | ||
27 | class RGWSI_User : public RGWServiceInstance | |
28 | { | |
29 | public: | |
30 | RGWSI_User(CephContext *cct); | |
31 | virtual ~RGWSI_User(); | |
32 | ||
33 | static string get_meta_key(const rgw_user& user) { | |
34 | return user.to_str(); | |
35 | } | |
36 | ||
37 | static rgw_user user_from_meta_key(const string& key) { | |
38 | return rgw_user(key); | |
39 | } | |
40 | ||
41 | virtual RGWSI_MetaBackend_Handler *get_be_handler() = 0; | |
42 | ||
43 | /* base svc_user interfaces */ | |
44 | ||
45 | virtual int read_user_info(RGWSI_MetaBackend::Context *ctx, | |
46 | const rgw_user& user, | |
47 | RGWUserInfo *info, | |
48 | RGWObjVersionTracker * const objv_tracker, | |
49 | real_time * const pmtime, | |
50 | rgw_cache_entry_info * const cache_info, | |
51 | map<string, bufferlist> * const pattrs, | |
b3b6e05e TL |
52 | optional_yield y, |
53 | const DoutPrefixProvider *dpp) = 0; | |
9f95a23c TL |
54 | |
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, | |
60 | bool exclusive, | |
61 | map<string, bufferlist> *attrs, | |
b3b6e05e TL |
62 | optional_yield y, |
63 | const DoutPrefixProvider *dpp) = 0; | |
9f95a23c TL |
64 | |
65 | virtual int remove_user_info(RGWSI_MetaBackend::Context *ctx, | |
66 | const RGWUserInfo& info, | |
67 | RGWObjVersionTracker *objv_tracker, | |
b3b6e05e TL |
68 | optional_yield y, |
69 | const DoutPrefixProvider *dpp) = 0; | |
9f95a23c TL |
70 | |
71 | virtual int get_user_info_by_email(RGWSI_MetaBackend::Context *ctx, | |
72 | const string& email, RGWUserInfo *info, | |
73 | RGWObjVersionTracker *objv_tracker, | |
74 | real_time *pmtime, | |
b3b6e05e TL |
75 | optional_yield y, |
76 | const DoutPrefixProvider *dpp) = 0; | |
9f95a23c TL |
77 | virtual int get_user_info_by_swift(RGWSI_MetaBackend::Context *ctx, |
78 | const string& swift_name, | |
79 | RGWUserInfo *info, /* out */ | |
80 | RGWObjVersionTracker * const objv_tracker, | |
81 | real_time * const pmtime, | |
b3b6e05e TL |
82 | optional_yield y, |
83 | const DoutPrefixProvider *dpp) = 0; | |
9f95a23c TL |
84 | virtual int get_user_info_by_access_key(RGWSI_MetaBackend::Context *ctx, |
85 | const std::string& access_key, | |
86 | RGWUserInfo *info, | |
87 | RGWObjVersionTracker* objv_tracker, | |
88 | real_time *pmtime, | |
b3b6e05e TL |
89 | optional_yield y, |
90 | const DoutPrefixProvider *dpp) = 0; | |
9f95a23c | 91 | |
b3b6e05e TL |
92 | virtual int add_bucket(const DoutPrefixProvider *dpp, |
93 | RGWSI_MetaBackend::Context *ctx, | |
9f95a23c TL |
94 | const rgw_user& user, |
95 | const rgw_bucket& bucket, | |
f67539c2 TL |
96 | ceph::real_time creation_time, |
97 | optional_yield y) = 0; | |
b3b6e05e TL |
98 | virtual int remove_bucket(const DoutPrefixProvider *dpp, |
99 | RGWSI_MetaBackend::Context *ctx, | |
9f95a23c | 100 | const rgw_user& user, |
f67539c2 | 101 | const rgw_bucket& _bucket, optional_yield) = 0; |
b3b6e05e TL |
102 | virtual int list_buckets(const DoutPrefixProvider *dpp, |
103 | RGWSI_MetaBackend::Context *ctx, | |
9f95a23c TL |
104 | const rgw_user& user, |
105 | const string& marker, | |
106 | const string& end_marker, | |
107 | uint64_t max, | |
108 | RGWUserBuckets *buckets, | |
f67539c2 TL |
109 | bool *is_truncated, |
110 | optional_yield y) = 0; | |
9f95a23c | 111 | |
b3b6e05e TL |
112 | virtual int flush_bucket_stats(const DoutPrefixProvider *dpp, |
113 | RGWSI_MetaBackend::Context *ctx, | |
9f95a23c | 114 | const rgw_user& user, |
f67539c2 | 115 | const RGWBucketEnt& ent, optional_yield y) = 0; |
b3b6e05e | 116 | virtual int complete_flush_stats(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, |
f67539c2 | 117 | const rgw_user& user, optional_yield y) = 0; |
b3b6e05e TL |
118 | virtual int reset_bucket_stats(const DoutPrefixProvider *dpp, |
119 | RGWSI_MetaBackend::Context *ctx, | |
f67539c2 TL |
120 | const rgw_user& user, |
121 | optional_yield y) = 0; | |
b3b6e05e TL |
122 | virtual int read_stats(const DoutPrefixProvider *dpp, |
123 | RGWSI_MetaBackend::Context *ctx, | |
9f95a23c TL |
124 | const rgw_user& user, RGWStorageStats *stats, |
125 | ceph::real_time *last_stats_sync, /* last time a full stats sync completed */ | |
f67539c2 TL |
126 | ceph::real_time *last_stats_update, |
127 | optional_yield y) = 0; /* last time a stats update was done */ | |
9f95a23c | 128 | |
b3b6e05e | 129 | virtual int read_stats_async(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, |
9f95a23c TL |
130 | const rgw_user& user, RGWGetUserStats_CB *cb) = 0; |
131 | }; | |
132 |