summaryrefslogtreecommitdiffstats
path: root/src/rgw/services/svc_user.h
blob: 1cb459d31cb212cf404b135bfeee3a05282c9713 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// -*- 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 "svc_meta_be.h"

#include "rgw_service.h"

class RGWUserBuckets;
class RGWGetUserStats_CB;

class RGWSI_User : public RGWServiceInstance
{
public:
  RGWSI_User(CephContext *cct);
  virtual ~RGWSI_User();

  static std::string get_meta_key(const rgw_user& user) {
    return user.to_str();
  }

  static rgw_user user_from_meta_key(const std::string& key) {
    return rgw_user(key);
  }

  virtual RGWSI_MetaBackend_Handler *get_be_handler() = 0;

  /* base svc_user interfaces */

  virtual int read_user_info(RGWSI_MetaBackend::Context *ctx,
                             const rgw_user& user,
                             RGWUserInfo *info,
                             RGWObjVersionTracker * const objv_tracker,
                             real_time * const pmtime,
                             rgw_cache_entry_info * const cache_info,
                             std::map<std::string, bufferlist> * const pattrs,
                             optional_yield y,
                             const DoutPrefixProvider *dpp) = 0;

  virtual int store_user_info(RGWSI_MetaBackend::Context *ctx,
                              const RGWUserInfo& info,
                              RGWUserInfo *old_info,
                              RGWObjVersionTracker *objv_tracker,
                              const real_time& mtime,
                              bool exclusive,
                              std::map<std::string, bufferlist> *attrs,
                              optional_yield y,
                              const DoutPrefixProvider *dpp) = 0;

  virtual int remove_user_info(RGWSI_MetaBackend::Context *ctx,
                               const RGWUserInfo& info,
                               RGWObjVersionTracker *objv_tracker,
                               optional_yield y,
                               const DoutPrefixProvider *dpp) = 0;

  virtual int get_user_info_by_email(RGWSI_MetaBackend::Context *ctx,
                             const std::string& email, RGWUserInfo *info,
                             RGWObjVersionTracker *objv_tracker,
                             real_time *pmtime,
                             optional_yield y,
                             const DoutPrefixProvider *dpp) = 0;
  virtual int get_user_info_by_swift(RGWSI_MetaBackend::Context *ctx,
                             const std::string& swift_name,
                             RGWUserInfo *info,        /* out */
                             RGWObjVersionTracker * const objv_tracker,
                             real_time * const pmtime,
                             optional_yield y,
                             const DoutPrefixProvider *dpp) = 0;
  virtual int get_user_info_by_access_key(RGWSI_MetaBackend::Context *ctx,
                                  const std::string& access_key,
                                  RGWUserInfo *info,
                                  RGWObjVersionTracker* objv_tracker,
                                  real_time *pmtime,
                                  optional_yield y,
                                  const DoutPrefixProvider *dpp) = 0;

  virtual int add_bucket(const DoutPrefixProvider *dpp, 
                         const rgw_user& user,
                         const rgw_bucket& bucket,
                         ceph::real_time creation_time,
                         optional_yield y) = 0;
  virtual int remove_bucket(const DoutPrefixProvider *dpp, 
                            const rgw_user& user,
                            const rgw_bucket& _bucket, optional_yield) = 0;
  virtual int list_buckets(const DoutPrefixProvider *dpp, 
                           const rgw_user& user,
                           const std::string& marker,
                           const std::string& end_marker,
                           uint64_t max,
                           RGWUserBuckets *buckets,
                           bool *is_truncated,
                           optional_yield y) = 0;

  virtual int flush_bucket_stats(const DoutPrefixProvider *dpp, 
                                 const rgw_user& user,
                                 const RGWBucketEnt& ent, optional_yield y) = 0;
  virtual int complete_flush_stats(const DoutPrefixProvider *dpp,
				   const rgw_user& user, optional_yield y) = 0;
  virtual int reset_bucket_stats(const DoutPrefixProvider *dpp, 
				 const rgw_user& user,
                                 optional_yield y) = 0;
  virtual int read_stats(const DoutPrefixProvider *dpp, 
                         RGWSI_MetaBackend::Context *ctx,
			 const rgw_user& user, RGWStorageStats *stats,
			 ceph::real_time *last_stats_sync,         /* last time a full stats sync completed */
			 ceph::real_time *last_stats_update,
                         optional_yield y) = 0;  /* last time a stats update was done */

  virtual int read_stats_async(const DoutPrefixProvider *dpp,
			       const rgw_user& user, RGWGetUserStats_CB *cb) = 0;
};