From 5623d84e1585bd8736150dbd2b04d573d59e0510 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 19 Jul 2019 11:06:39 -0400 Subject: [PATCH] rgw: simplify RGWOTPCtl params with default arguments Signed-off-by: Casey Bodley --- src/rgw/rgw_otp.cc | 9 +++------ src/rgw/rgw_otp.h | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/rgw/rgw_otp.cc b/src/rgw/rgw_otp.cc index 33c6de8e7c5..a923364b0ce 100644 --- a/src/rgw/rgw_otp.cc +++ b/src/rgw/rgw_otp.cc @@ -173,9 +173,8 @@ void RGWOTPCtl::init(RGWOTPMetadataHandler *_meta_handler) int RGWOTPCtl::read_all(const rgw_user& uid, RGWOTPInfo *info, optional_yield y, - ceph::optional_ref_default _params) + const GetParams& params) { - auto& params = *_params; info->uid = uid; return meta_handler->call([&](RGWSI_OTP_BE_Ctx& ctx) { return svc.otp->read_all(ctx, uid, &info->devices, params.mtime, params.objv_tracker, y); @@ -184,9 +183,8 @@ int RGWOTPCtl::read_all(const rgw_user& uid, int RGWOTPCtl::store_all(const RGWOTPInfo& info, optional_yield y, - ceph::optional_ref_default _params) + const PutParams& params) { - auto& params = *_params; return meta_handler->call([&](RGWSI_OTP_BE_Ctx& ctx) { return svc.otp->store_all(ctx, info.uid, info.devices, params.mtime, params.objv_tracker, y); }); @@ -194,9 +192,8 @@ int RGWOTPCtl::store_all(const RGWOTPInfo& info, int RGWOTPCtl::remove_all(const rgw_user& uid, optional_yield y, - ceph::optional_ref_default _params) + const RemoveParams& params) { - auto& params = *_params; return meta_handler->call([&](RGWSI_OTP_BE_Ctx& ctx) { return svc.otp->remove_all(ctx, uid, params.objv_tracker, y); }); diff --git a/src/rgw/rgw_otp.h b/src/rgw/rgw_otp.h index 7678070aff4..6e51086b2dd 100644 --- a/src/rgw/rgw_otp.h +++ b/src/rgw/rgw_otp.h @@ -4,8 +4,6 @@ #ifndef CEPH_RGW_OTP_H #define CEPH_RGW_OTP_H -#include "common/optional_ref_default.h" - #include "cls/otp/cls_otp_types.h" #include "services/svc_meta_be_otp.h" @@ -59,6 +57,8 @@ public: RGWObjVersionTracker *objv_tracker{nullptr}; ceph::real_time *mtime{nullptr}; + GetParams() {} + GetParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) { objv_tracker = _objv_tracker; return *this; @@ -74,6 +74,8 @@ public: RGWObjVersionTracker *objv_tracker{nullptr}; ceph::real_time mtime; + PutParams() {} + PutParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) { objv_tracker = _objv_tracker; return *this; @@ -88,15 +90,20 @@ public: struct RemoveParams { RGWObjVersionTracker *objv_tracker{nullptr}; + RemoveParams() {} + RemoveParams& set_objv_tracker(RGWObjVersionTracker *_objv_tracker) { objv_tracker = _objv_tracker; return *this; } }; - int read_all(const rgw_user& uid, RGWOTPInfo *info, optional_yield y, ceph::optional_ref_default params); - int store_all(const RGWOTPInfo& info, optional_yield y, ceph::optional_ref_default params); - int remove_all(const rgw_user& user, optional_yield y, ceph::optional_ref_default params); + int read_all(const rgw_user& uid, RGWOTPInfo *info, optional_yield y, + const GetParams& params = {}); + int store_all(const RGWOTPInfo& info, optional_yield y, + const PutParams& params = {}); + int remove_all(const rgw_user& user, optional_yield y, + const RemoveParams& params = {}); }; #endif -- 2.39.5