-
Notifications
You must be signed in to change notification settings - Fork 596
refactor(services/aliyun_drive): Move raw request to core #6089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(services/aliyun_drive): Move raw request to core #6089
Conversation
@@ -399,6 +399,14 @@ impl AliyunDriveCore { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with that @erickguan , thanks for the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are welcome.
🚀
|
||
let download_url = self.core.get_download_url(&file.file_id).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored this as @erickguan suggested #6089 (comment)
.core | ||
.get_upload_url(file_id, upload_id, Some(self.part_number)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored this as @erickguan suggested #6089 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jorgehermo9 for the PR!
Relates to https://github.com/apache/opendal/pull/6063/files#r2051703445