]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: conditional clone, depends on src_cmpxattr result
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 4 Aug 2011 23:21:57 +0000 (16:21 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 4 Aug 2011 23:21:57 +0000 (16:21 -0700)
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 71799f5b6fa989a57f544d45d803179e893857e6..f5a8a8cd7bc5e4b71dac8d0fc7386c4960e0e075 100644 (file)
@@ -1075,7 +1075,7 @@ int RGWRados::clone_objs(void *ctx, rgw_obj& dst_obj,
                         vector<RGWCloneRangeInfo>& ranges,
                         map<string, bufferlist> attrs,
                         bool truncate_dest,
-                        pair<string, bufferlist> *cmp_xattr)
+                        pair<string, bufferlist> *xattr_cond)
 {
   std::string& bucket = dst_obj.bucket;
   std::string& dst_oid = dst_obj.object;
@@ -1118,6 +1118,10 @@ int RGWRados::clone_objs(void *ctx, rgw_obj& dst_obj,
     }
     if (range.len) {
       RGW_LOG(20) << "calling op.clone_range(dst_ofs=" << range.dst_ofs << ", src.object=" <<  range.src.object << " range.src_ofs=" << range.src_ofs << " range.len=" << range.len << dendl;
+      if (xattr_cond) {
+        op.src_cmpxattr(range.src.object, xattr_cond->first.c_str(),
+                        LIBRADOS_CMPXATTR_OP_EQ, xattr_cond->second);
+      }
       op.clone_range(range.dst_ofs, range.src.object, range.src_ofs, range.len);
     }
   }
index 8b6003a8d11b6da892a16f83503f59f6ef05c488..d2957fd7bbce95ebd94b8ceab752b17104f98cdb 100644 (file)
@@ -112,7 +112,7 @@ public:
   int clone_obj_cond(void *ctx, rgw_obj& dst_obj, off_t dst_ofs,
                 rgw_obj& src_obj, off_t src_ofs,
                 uint64_t size, map<string, bufferlist> attrs,
-                pair<string, bufferlist> *cmp_xattr) {
+                pair<string, bufferlist> *xattr_cond) {
     RGWCloneRangeInfo info;
     vector<RGWCloneRangeInfo> v;
     info.src = src_obj;
@@ -120,7 +120,7 @@ public:
     info.dst_ofs = dst_ofs;
     info.len = size;
     v.push_back(info);
-    return clone_objs(ctx, dst_obj, v, attrs, true, cmp_xattr);
+    return clone_objs(ctx, dst_obj, v, attrs, true, xattr_cond);
   }
 
   /** Copy an object, with many extra options */