#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"
class RGWIndexCompletionManager;
-class RGWRados
+class RGWRados : public AdminSocketHook
{
friend class RGWGC;
friend class RGWMetaNotifier;
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();
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,
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,