]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_rados.h
update sources to v12.2.5
[ceph.git] / ceph / src / rgw / rgw_rados.h
index 58848b0419d90a618c8893bd2641f12f88f6ebaa..a5ba0325a606fbecf16267092a01fb876d0cff2e 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "include/rados/librados.hpp"
 #include "include/Context.h"
+#include "common/admin_socket.h"
 #include "common/RefCountedObj.h"
 #include "common/RWLock.h"
 #include "common/ceph_time.h"
@@ -2204,7 +2205,7 @@ struct tombstone_entry {
 
 class RGWIndexCompletionManager;
 
-class RGWRados
+class RGWRados : public AdminSocketHook
 {
   friend class RGWGC;
   friend class RGWMetaNotifier;
@@ -2220,6 +2221,8 @@ class RGWRados
   friend class BucketIndexLockGuard;
   friend class RGWCompleteMultipart;
 
+  static const char* admin_commands[4][3];
+
   /** Open the pool used as root for this gateway */
   int open_root_pool_ctx();
   int open_gc_pool_ctx();
@@ -3411,6 +3414,43 @@ private:
                       boost::optional<obj_version> refresh_version);
 public:
 
+  bool call(std::string command, cmdmap_t& cmdmap, std::string format,
+           bufferlist& out) override final;
+
+  // Should really be protected, but some older GCCs don't handle
+  // access control properly with lambdas defined in member functions
+  // of child classes.
+
+  void cache_list_dump_helper(Formatter* f,
+                             const std::string& name,
+                             const ceph::real_time mtime,
+                             const std::uint64_t size) {
+    f->dump_string("name", name);
+    f->dump_string("mtime", ceph::to_iso_8601(mtime));
+    f->dump_unsigned("size", size);
+  }
+
+protected:
+
+  // `call_list` must iterate over all cache entries and call
+  // `cache_list_dump_helper` with the supplied Formatter on any that
+  // include `filter` as a substring.
+  //
+  virtual void call_list(const boost::optional<std::string>& filter,
+                        Formatter* format);
+  // `call_inspect` must look up the requested target and, if found,
+  // dump it to the supplied Formatter and return true. If not found,
+  // it must return false.
+  //
+  virtual bool call_inspect(const std::string& target, Formatter* format);
+
+  // `call_erase` must erase the requested target and return true. If
+  // the requested target does not exist, it should return false.
+  virtual bool call_erase(const std::string& target);
+
+  // `call_zap` must erase the cache.
+  virtual void call_zap();
+public:
 
   int get_bucket_info(RGWObjectCtx& obj_ctx,
                      const string& tenant_name, const string& bucket_name,
@@ -3541,6 +3581,7 @@ public:
   int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix);
 
   int cls_user_get_header(const string& user_id, cls_user_header *header);
+  int cls_user_reset_stats(const string& user_id);
   int cls_user_get_header_async(const string& user_id, RGWGetUserHeader_CB *ctx);
   int cls_user_sync_bucket_stats(rgw_raw_obj& user_obj, const RGWBucketInfo& bucket_info);
   int cls_user_list_buckets(rgw_raw_obj& obj,