]>
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, | |
52 | optional_yield y) = 0; | |
53 | ||
54 | virtual int store_user_info(RGWSI_MetaBackend::Context *ctx, | |
55 | const RGWUserInfo& info, | |
56 | RGWUserInfo *old_info, | |
57 | RGWObjVersionTracker *objv_tracker, | |
58 | const real_time& mtime, | |
59 | bool exclusive, | |
60 | map<string, bufferlist> *attrs, | |
61 | optional_yield y) = 0; | |
62 | ||
63 | virtual int remove_user_info(RGWSI_MetaBackend::Context *ctx, | |
64 | const RGWUserInfo& info, | |
65 | RGWObjVersionTracker *objv_tracker, | |
66 | optional_yield y) = 0; | |
67 | ||
68 | virtual int get_user_info_by_email(RGWSI_MetaBackend::Context *ctx, | |
69 | const string& email, RGWUserInfo *info, | |
70 | RGWObjVersionTracker *objv_tracker, | |
71 | real_time *pmtime, | |
72 | optional_yield y) = 0; | |
73 | virtual int get_user_info_by_swift(RGWSI_MetaBackend::Context *ctx, | |
74 | const string& swift_name, | |
75 | RGWUserInfo *info, /* out */ | |
76 | RGWObjVersionTracker * const objv_tracker, | |
77 | real_time * const pmtime, | |
78 | optional_yield y) = 0; | |
79 | virtual int get_user_info_by_access_key(RGWSI_MetaBackend::Context *ctx, | |
80 | const std::string& access_key, | |
81 | RGWUserInfo *info, | |
82 | RGWObjVersionTracker* objv_tracker, | |
83 | real_time *pmtime, | |
84 | optional_yield y) = 0; | |
85 | ||
86 | virtual int add_bucket(RGWSI_MetaBackend::Context *ctx, | |
87 | const rgw_user& user, | |
88 | const rgw_bucket& bucket, | |
f67539c2 TL |
89 | ceph::real_time creation_time, |
90 | optional_yield y) = 0; | |
9f95a23c TL |
91 | virtual int remove_bucket(RGWSI_MetaBackend::Context *ctx, |
92 | const rgw_user& user, | |
f67539c2 | 93 | const rgw_bucket& _bucket, optional_yield) = 0; |
9f95a23c TL |
94 | virtual int list_buckets(RGWSI_MetaBackend::Context *ctx, |
95 | const rgw_user& user, | |
96 | const string& marker, | |
97 | const string& end_marker, | |
98 | uint64_t max, | |
99 | RGWUserBuckets *buckets, | |
f67539c2 TL |
100 | bool *is_truncated, |
101 | optional_yield y) = 0; | |
9f95a23c TL |
102 | |
103 | virtual int flush_bucket_stats(RGWSI_MetaBackend::Context *ctx, | |
104 | const rgw_user& user, | |
f67539c2 | 105 | const RGWBucketEnt& ent, optional_yield y) = 0; |
9f95a23c | 106 | virtual int complete_flush_stats(RGWSI_MetaBackend::Context *ctx, |
f67539c2 | 107 | const rgw_user& user, optional_yield y) = 0; |
9f95a23c | 108 | virtual int reset_bucket_stats(RGWSI_MetaBackend::Context *ctx, |
f67539c2 TL |
109 | const rgw_user& user, |
110 | optional_yield y) = 0; | |
9f95a23c TL |
111 | virtual int read_stats(RGWSI_MetaBackend::Context *ctx, |
112 | const rgw_user& user, RGWStorageStats *stats, | |
113 | ceph::real_time *last_stats_sync, /* last time a full stats sync completed */ | |
f67539c2 TL |
114 | ceph::real_time *last_stats_update, |
115 | optional_yield y) = 0; /* last time a stats update was done */ | |
9f95a23c TL |
116 | |
117 | virtual int read_stats_async(RGWSI_MetaBackend::Context *ctx, | |
118 | const rgw_user& user, RGWGetUserStats_CB *cb) = 0; | |
119 | }; | |
120 |