Skip to content

Commit d02d239

Browse files
committed
remove unused constructor for s3 storage
1 parent 6e1c627 commit d02d239

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

quickwit/quickwit-storage/src/object_storage/s3_compatible_storage.rs

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn get_region(s3_storage_config: &S3StorageConfig) -> Option<Region> {
127127
})
128128
}
129129

130-
pub(crate) async fn create_s3_client(s3_storage_config: &S3StorageConfig) -> S3Client {
130+
pub async fn create_s3_client(s3_storage_config: &S3StorageConfig) -> S3Client {
131131
let aws_config = get_aws_config().await;
132132
let credentials_provider =
133133
get_credentials_provider(s3_storage_config).or(aws_config.credentials_provider());
@@ -155,28 +155,6 @@ pub(crate) async fn create_s3_client(s3_storage_config: &S3StorageConfig) -> S3C
155155
}
156156

157157
impl S3CompatibleObjectStorage {
158-
/// Creates an object storage given a region, a bucket name and an S3 client.
159-
pub async fn new(
160-
s3_storage_config: &S3StorageConfig,
161-
uri: Uri,
162-
bucket: String,
163-
s3_client: S3Client,
164-
) -> Result<Self, StorageResolverError> {
165-
let retry_params = RetryParams::aggressive();
166-
let disable_multi_object_delete = s3_storage_config.disable_multi_object_delete;
167-
let disable_multipart_upload = s3_storage_config.disable_multipart_upload;
168-
Ok(Self {
169-
s3_client,
170-
uri,
171-
bucket,
172-
prefix: PathBuf::new(),
173-
multipart_policy: MultiPartPolicy::default(),
174-
retry_params,
175-
disable_multi_object_delete,
176-
disable_multipart_upload,
177-
})
178-
}
179-
180158
/// Creates an object storage given a region and an uri.
181159
pub async fn from_uri(
182160
s3_storage_config: &S3StorageConfig,
@@ -196,8 +174,19 @@ impl S3CompatibleObjectStorage {
196174
let message = format!("failed to extract bucket name from S3 URI: {uri}");
197175
StorageResolverError::InvalidUri(message)
198176
})?;
199-
let storage = Self::new(s3_storage_config, uri.clone(), bucket, s3_client).await?;
200-
Ok(storage.with_prefix(prefix))
177+
let retry_params = RetryParams::aggressive();
178+
let disable_multi_object_delete = s3_storage_config.disable_multi_object_delete;
179+
let disable_multipart_upload = s3_storage_config.disable_multipart_upload;
180+
Ok(Self {
181+
s3_client,
182+
uri: uri.clone(),
183+
bucket,
184+
prefix,
185+
multipart_policy: MultiPartPolicy::default(),
186+
retry_params,
187+
disable_multi_object_delete,
188+
disable_multipart_upload,
189+
})
201190
}
202191

203192
/// Sets a specific for all buckets.

quickwit/quickwit-storage/src/object_storage/s3_compatible_storage_resolver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ use crate::{
3333
/// S3 compatible object storage resolver.
3434
pub struct S3CompatibleObjectStorageFactory {
3535
storage_config: S3StorageConfig,
36-
// we cache the S3Client so we don't rebuild one every time we need to connect to S3.
36+
// we cache the S3Client so we don't rebuild one every time we build a new Storage (for
37+
// every search query).
3738
// We don't build it in advance because we don't know if this factory is one that will
3839
// end up being used, or if something like azure, gcs, or even local files, will be used
3940
// instead.

0 commit comments

Comments
 (0)