-
Notifications
You must be signed in to change notification settings - Fork 70
impl(storage): configurable buffered upload types #2710
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
base: main
Are you sure you want to change the base?
impl(storage): configurable buffered upload types #2710
Conversation
Switch the upload type based on the size of the payload. Small uploads perform better when using single-shot uploads. Large uploads require resumable uploads to keep the buffer size under control, and the extra latency is not that bad in relative terms.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2710 +/- ##
==========================================
+ Coverage 95.59% 95.71% +0.11%
==========================================
Files 93 93
Lines 4018 4034 +16
==========================================
+ Hits 3841 3861 +20
+ Misses 177 173 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Move IterSource
back into mod tests
?
// TODO(#2043) - make the threshold to use resumable uploads and the | ||
// target size for each chunk configurable. |
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.
nit: stale comment
// TODO(#2043) - make the threshold to use resumable uploads and the | ||
// target size for each chunk configurable. | ||
if self.payload.lock().await.size_hint().0 > RESUMABLE_UPLOAD_QUANTUM as u64 { | ||
let hint = self.payload.lock().await.size_hint().1; | ||
if hint.is_some_and(|max| max >= self.options.resumable_upload_threshold as u64) { |
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.
Q: should the default for unknown-sized objects be resumable uploads? i.e. s/is_some_and/is_none_or/
@@ -205,23 +214,84 @@ impl Seek for BytesSource { | |||
} | |||
} | |||
|
|||
pub struct IterSource { |
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.
is this intentionally public?
impl Seek for IterSource { | ||
type Error = std::io::Error; | ||
async fn seek(&mut self, offset: u64) -> std::result::Result<(), Self::Error> { | ||
let mut current: VecDeque<_> = self.contents.iter().cloned().collect(); |
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.
if this is a public type, this implementation should be more efficient. We only need to clone the chunks from contents
which have already been consumed from current
.
Switch the upload type based on the size of the payload. Small uploads
perform better when using single-shot uploads. Large uploads require
resumable uploads to keep the buffer size under control, and the extra
latency is not that bad in relative terms.
Fixes #2709, fixes #2056