RinChanNOWWW opened a new issue, #5672:
URL: https://github.com/apache/opendal/issues/5672

   ### Feature Description
   
   Currently, the `copy` API in OpenDAL can only copy an object within the same 
bucket.
   
   In fact, object store services like [AWS 
S3](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html) and 
[Tencent Cloud COS](https://www.tencentcloud.com/document/product/436/10881) 
already support copy objects across buckets and regions.
   
   It will be very nice if OpenDAL can also support this feature.
   
   ### Problem and Solution
   
   Take COS implementation in OpenDAL as an example:
   
   ```rust
   pub async fn cos_copy_object(&self, from: &str, to: &str) -> 
Result<Response<Buffer>> {
           let source = build_abs_path(&self.root, from);
           let target = build_abs_path(&self.root, to);
   
           let source = format!("/{}/{}", self.bucket, 
percent_encode_path(&source));
           let url = format!("{}/{}", self.endpoint, 
percent_encode_path(&target));
   
           let mut req = Request::put(&url)
               .header("x-cos-copy-source", &source)
               .body(Buffer::new())
               .map_err(new_request_build_error)?;
   
           self.sign(&mut req).await?;
   
           self.send(req).await
       }
   ```
   
   When constructing `source` for "x-cos-copy-source", we can fill the 
parameters of another bucket.
   
   Refercen from https://www.tencentcloud.com/document/product/436/10881:
   > 
\<SourceBucketName-SourceAPPID\>.cos.\<SourceRegion\>.myqcloud.com/\<SourceObjectKey\>
   
   ### Additional Context
   
   _No response_
   
   ### Are you willing to contribute to the development of this feature?
   
   - [ ] Yes, I am willing to contribute to the development of this feature.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to