refactor(services/aliyun_drive): Move raw request to core#6089
refactor(services/aliyun_drive): Move raw request to core#6089Xuanwo merged 11 commits intoapache:mainfrom
Conversation
| self.send(req, token.as_deref()).await | ||
| } | ||
|
|
||
| pub async fn download(&self, download_url: &str, range: BytesRange) -> Result<Buffer> { |
There was a problem hiding this comment.
similar to how upload method is done
| .header(header::RANGE, args.range().to_header()) | ||
| .body(Buffer::new()) | ||
| .map_err(new_request_build_error)?; | ||
| let resp = self.core.download(&download_url, args.range()).await?; |
There was a problem hiding this comment.
Same as https://github.com/apache/opendal/pull/6090/files#r2061281070. Should we move both get_download_url and download(download_url) into a single method download_file in core?
There was a problem hiding this comment.
Reasonable to keep a single function.
An alternative is that AliyunDriveCore::download calls the get_download_url. Then the functions are more modular.
And I hope rustc will inline the function.
There was a problem hiding this comment.
Agree with that @erickguan , thanks for the review
| serde_json::from_reader(res.reader()).map_err(new_json_serialize_error)?; | ||
| let resp = self.core.download(&file.file_id, args.range()).await?; | ||
|
|
||
| let download_url = self.core.get_download_url(&file.file_id).await?; |
There was a problem hiding this comment.
Refactored this as @erickguan suggested #6089 (comment)
| let res = self | ||
| if let Err(err) = self | ||
| .core | ||
| .get_upload_url(file_id, upload_id, Some(self.part_number)) |
There was a problem hiding this comment.
Refactored this as @erickguan suggested #6089 (comment)
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you @jorgehermo9 for the PR!
Relates to https://github.com/apache/opendal/pull/6063/files#r2051703445