From 8d34bd4c4c0896b3142582c6372aa4aa896220a2 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 11 Jun 2019 12:37:53 -0700 Subject: [PATCH] rgw: svc.bucket: adding missing files Signed-off-by: Yehuda Sadeh --- src/rgw/services/svc_bucket.cc | 23 ++++++++ src/rgw/services/svc_bucket.h | 100 +++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 src/rgw/services/svc_bucket.cc create mode 100644 src/rgw/services/svc_bucket.h diff --git a/src/rgw/services/svc_bucket.cc b/src/rgw/services/svc_bucket.cc new file mode 100644 index 00000000000..dcd24fc2b9f --- /dev/null +++ b/src/rgw/services/svc_bucket.cc @@ -0,0 +1,23 @@ + + +#include "svc_bucket.h" + +#define dout_subsys ceph_subsys_rgw + +string RGWSI_Bucket::get_entrypoint_meta_key(const rgw_bucket& bucket) +{ + if (bucket.bucket_id.empty()) { + return bucket.get_key(); + } + + rgw_bucket b(bucket); + b.bucket_id.clear(); + + return b.get_key(); +} + +string RGWSI_Bucket::get_bi_meta_key(const rgw_bucket& bucket) +{ + return bucket.get_key(); +} + diff --git a/src/rgw/services/svc_bucket.h b/src/rgw/services/svc_bucket.h new file mode 100644 index 00000000000..d1d1705ec60 --- /dev/null +++ b/src/rgw/services/svc_bucket.h @@ -0,0 +1,100 @@ + +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +/* + * 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 "rgw/rgw_service.h" + +#include "svc_bucket_types.h" + +class RGWSI_Bucket : public RGWServiceInstance +{ +public: + RGWSI_Bucket(CephContext *cct) : RGWServiceInstance(cct) {} + virtual ~RGWSI_Bucket() {} + + static string get_entrypoint_meta_key(const rgw_bucket& bucket); + static string get_bi_meta_key(const rgw_bucket& bucket); + + virtual RGWSI_Bucket_BE_Handler& get_ep_be_handler() = 0; + virtual RGWSI_BucketInstance_BE_Handler& get_bi_be_handler() = 0; + + virtual int read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, + const string& key, + RGWBucketEntryPoint *entry_point, + RGWObjVersionTracker *objv_tracker, + real_time *pmtime, + map *pattrs, + optional_yield y, + rgw_cache_entry_info *cache_info = nullptr, + boost::optional refresh_version = boost::none) = 0; + + virtual int store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, + const string& key, + RGWBucketEntryPoint& info, + bool exclusive, + real_time mtime, + map *pattrs, + RGWObjVersionTracker *objv_tracker, + optional_yield y) = 0; + + virtual int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, + const string& key, + RGWObjVersionTracker *objv_tracker) = 0; + + virtual int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, + const string& key, + RGWBucketInfo *info, + real_time *pmtime, + map *pattrs, + optional_yield y, + rgw_cache_entry_info *cache_info = nullptr, + boost::optional refresh_version = boost::none) = 0; + + virtual int read_bucket_info(RGWSI_Bucket_X_Ctx& ep_ctx, + const rgw_bucket& bucket, + RGWBucketInfo *info, + real_time *pmtime, + map *pattrs, + boost::optional refresh_version, + optional_yield y) = 0; + + virtual int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, + const string& key, + RGWBucketInfo& info, + std::optional orig_info, /* nullopt: orig_info was not fetched, + nullptr: orig_info was not found (new bucket instance */ + bool exclusive, + real_time mtime, + map *pattrs, + optional_yield y) = 0; + + virtual int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, + const string& key, + RGWObjVersionTracker *objv_tracker, + optional_yield y) = 0; + + virtual int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx, + const rgw_bucket& bucket, + RGWBucketEnt *ent, + optional_yield y) = 0; + + virtual int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx, + map& m, + optional_yield y) = 0; +}; + -- 2.39.5