]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: pass list_parts_each_t function by lvalue reference
authorKefu Chai <tchaikov@gmail.com>
Wed, 16 Jul 2025 08:45:55 +0000 (16:45 +0800)
committerKefu Chai <tchaikov@gmail.com>
Wed, 16 Jul 2025 08:52:33 +0000 (16:52 +0800)
list_parts_each_t is an alias of
`fu2::unique_function<int(const Part&) const>`, which is a non copyable
function. so in theory, we cannot copy it. and in the recent version of
function2, unique_function is not coyable anymore. if we bump up the
vendored function2.hpp, the build breaks.

so, in this change, we change the virtual function of
`Object::list_parts()` from passing the plain value of
`list_parts_each_t` to rvalue reference `list_parts_each_t` so that we
don't need to copy this non-copyable function. this allows us to
keep in sync with upstream function2, and to be symantically correct
regarding to the unique-ness of the functor.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/rgw/driver/posix/rgw_sal_posix.cc
src/rgw/driver/posix/rgw_sal_posix.h
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.cc
src/rgw/rgw_sal_filter.h

index d72b38ee45bb87f7a9cf425a462f6c5461172fae..e4bb6d0a07f7173427e018ae680abafa0612f80c 100644 (file)
@@ -2911,7 +2911,7 @@ int POSIXObject::copy_object(const ACLOwner& owner,
 
 int POSIXObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                            int max_parts, int marker, int* next_marker,
-                           bool* truncated, list_parts_each_t each_func,
+                           bool* truncated, list_parts_each_t&& each_func,
                            optional_yield y)
 {
   return -EOPNOTSUPP;
index fdf2b9d510fe8b6410ecd4a603b0724e4becf321..1d728d640cf1f08f29429c9fb9a29cba9953956b 100644 (file)
@@ -661,7 +661,7 @@ public:
   /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */
   virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                         int max_parts, int marker, int* next_marker,
-                        bool* truncated, list_parts_each_t each_func,
+                        bool* truncated, list_parts_each_t&& each_func,
                         optional_yield y) override;
 
   bool is_sync_completed(const DoutPrefixProvider* dpp, optional_yield y,
index efdfdeccc7941da469f96b544be37bd9350f2673..0fa996b51d36dd2bd31ac67b931fff68e234d9a5 100644 (file)
@@ -2677,7 +2677,7 @@ bool RadosObject::is_sync_completed(const DoutPrefixProvider* dpp,
 
 int RadosObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                           int max_parts, int marker, int* next_marker,
-                          bool* truncated, list_parts_each_t each_func,
+                          bool* truncated, list_parts_each_t&& each_func,
                           optional_yield y)
 {
   int ret{0};
index d51d968aa6158ca674d428a3373aa124868c1514..92bb1547493c21abf19c6516878e7018a5a79345 100644 (file)
@@ -609,7 +609,7 @@ class RadosObject : public StoreObject {
     /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */
     virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                           int max_parts, int marker, int* next_marker,
-                          bool* truncated, list_parts_each_t each_func,
+                          bool* truncated, list_parts_each_t&& each_func,
                           optional_yield y) override;
 
     virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, Attrs* delattrs, optional_yield y, uint32_t flags) override;
index 3f9fc829a3e9bb5222ca78d9a4282a20bc2c0b06..3f24f1110d320359ecc04df30fa876667ec33016 100644 (file)
@@ -1303,7 +1303,7 @@ class Object {
     /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */
     virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                           int max_parts, int marker, int* next_marker,
-                          bool* truncated, list_parts_each_t each_func,
+                          bool* truncated, list_parts_each_t&& each_func,
                           optional_yield y) = 0;
 
     /** Get the cached attributes for this object */
index e1bbe2cdf891aa1dfe79cc15929a034482ac8f2f..8e2b912651db022620fe7e9eff26495e80767360 100644 (file)
@@ -492,7 +492,7 @@ namespace rgw::sal {
 
   int DBObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                           int max_parts, int marker, int* next_marker,
-                          bool* truncated, list_parts_each_t each_func,
+                          bool* truncated, list_parts_each_t&& each_func,
                           optional_yield y)
   {
     return -EOPNOTSUPP;
index 68a94742ad3a589903eb296857af23ea6ebb3440..ae71796903a0e568c7ad75af59793d2fd2aa4b80 100644 (file)
@@ -563,7 +563,7 @@ protected:
       /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */
       virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                           int max_parts, int marker, int* next_marker,
-                          bool* truncated, list_parts_each_t each_func,
+                          bool* truncated, list_parts_each_t&& each_func,
                           optional_yield y) override;
 
       bool is_sync_completed(const DoutPrefixProvider* dpp, optional_yield y,
index 62421bb9832725c356863bd375ceb63271338ad8..9097748bfe671905f0e5eb90bbccb243be0a4f36 100644 (file)
@@ -1064,12 +1064,12 @@ RGWAccessControlPolicy& FilterObject::get_acl()
 
 int FilterObject::list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                             int max_parts, int marker, int* next_marker,
-                            bool* truncated, list_parts_each_t each_func,
+                            bool* truncated, list_parts_each_t&& each_func,
                             optional_yield y)
 {
   return next->list_parts(dpp, cct, max_parts, marker, next_marker,
                          truncated,
-                         sal::Object::list_parts_each_t(each_func),
+                         std::move(each_func),
                          y);
 }
 
index 526f7ce2badee073d349b636024705c3cf5c8ab5..e67b2526738b084eb05c8cfcd0ee6d1ec3f24b5d 100644 (file)
@@ -800,7 +800,7 @@ public:
   /** If multipart, enumerate (a range [marker..marker+[min(max_parts, parts_count-1)] of) parts of the object */
   virtual int list_parts(const DoutPrefixProvider* dpp, CephContext* cct,
                         int max_parts, int marker, int* next_marker,
-                        bool* truncated, list_parts_each_t each_func,
+                        bool* truncated, list_parts_each_t&& each_func,
                         optional_yield y) override;
 
   virtual int load_obj_state(const DoutPrefixProvider *dpp, optional_yield y,