Skip to content
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

fix(services/s3): Batch max operations from config #2354

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/src/services/s3/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::collections::HashMap;
use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Write;
use std::string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not seeing why we need to use std::string here.

use std::sync::Arc;

use async_trait::async_trait;
Expand Down Expand Up @@ -93,6 +94,8 @@ pub struct S3Builder {
/// the part size of s3 multipart upload, which should be 5 MiB to 5 GiB.
/// There is no minimum size limit on the last part of your multipart upload
write_min_size: Option<usize>,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a new function for batch_max_operations so that users can assign it.

batch_max_opertaions: Option<usize>,
}

impl Debug for S3Builder {
Expand All @@ -103,7 +106,6 @@ impl Debug for S3Builder {
.field("bucket", &self.bucket)
.field("endpoint", &self.endpoint)
.field("region", &self.region);

d.finish_non_exhaustive()
}
}
Expand Down Expand Up @@ -510,6 +512,13 @@ impl S3Builder {

self
}

/// Sets maximum batch operations.
pub fn batch_max_operations(&mut self, batch_max_operations: usize) -> &mut Self {
self.batch_max_opertaions = Some(batch_max_operations);

self
}
}

impl Builder for S3Builder {
Expand Down Expand Up @@ -714,6 +723,7 @@ impl Builder for S3Builder {
loader,
client,
write_min_size,
batch_max_operations: self.batch_max_operations,
}),
})
}
Expand Down
1 change: 1 addition & 0 deletions core/src/services/s3/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub struct S3Core {
pub loader: AwsLoader,
pub client: HttpClient,
pub write_min_size: usize,
pub batch_max_operations: usize,
}

impl Debug for S3Core {
Expand Down