From: Casey Bodley Date: Fri, 19 Jul 2019 15:23:47 +0000 (-0400) Subject: rgw: simplify RGWSI_RADOS params with default arguments X-Git-Tag: v15.1.0~1898^2^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e5c15be2fa6c55df748102dd629bf37d5e4a2ba;p=ceph.git rgw: simplify RGWSI_RADOS params with default arguments Signed-off-by: Casey Bodley --- diff --git a/src/rgw/services/svc_rados.cc b/src/rgw/services/svc_rados.cc index c139ee91c48e..dea97e36a3b3 100644 --- a/src/rgw/services/svc_rados.cc +++ b/src/rgw/services/svc_rados.cc @@ -54,11 +54,11 @@ uint64_t RGWSI_RADOS::instance_id() } int RGWSI_RADOS::open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx, - ceph::optional_ref_default params) + const OpenParams& params) { return rgw_init_ioctx(get_rados_handle(), pool, io_ctx, - params->create, - params->mostly_omap); + params.create, + params.mostly_omap); } int RGWSI_RADOS::pool_iterate(librados::IoCtx& io_ctx, @@ -284,9 +284,9 @@ int RGWSI_RADOS::Pool::lookup() return 0; } -int RGWSI_RADOS::Pool::open(ceph::optional_ref_default params) +int RGWSI_RADOS::Pool::open(const OpenParams& params) { - return rados_svc->open_pool_ctx(pool, state.ioctx); + return rados_svc->open_pool_ctx(pool, state.ioctx, params); } int RGWSI_RADOS::Pool::List::init(const string& marker, RGWAccessListFilter *filter) diff --git a/src/rgw/services/svc_rados.h b/src/rgw/services/svc_rados.h index 9d56e8f294a6..595b7a4fd2d3 100644 --- a/src/rgw/services/svc_rados.h +++ b/src/rgw/services/svc_rados.h @@ -9,8 +9,6 @@ #include "common/async/yield_context.h" #include "common/RWLock.h" -#include "common/optional_ref_default.h" - class RGWAsyncRadosProcessor; class RGWAccessListFilter { @@ -40,6 +38,8 @@ public: bool create{true}; bool mostly_omap{false}; + OpenParams() {} + OpenParams& set_create(bool _create) { create = _create; return *this; @@ -53,7 +53,7 @@ public: private: librados::Rados* get_rados_handle(); int open_pool_ctx(const rgw_pool& pool, librados::IoCtx& io_ctx, - ceph::optional_ref_default params = std::nullopt); + const OpenParams& params = {}); int pool_iterate(librados::IoCtx& ioctx, librados::NObjectIterator& iter, uint32_t num, vector& objs, @@ -98,7 +98,7 @@ public: int create(); int create(const std::vector& pools, std::vector *retcodes); int lookup(); - int open(ceph::optional_ref_default params = std::nullopt); + int open(const OpenParams& params = {}); const rgw_pool& get_pool() { return pool;