diff --git a/services/blob/Cargo.lock b/services/blob/Cargo.lock --- a/services/blob/Cargo.lock +++ b/services/blob/Cargo.lock @@ -829,7 +829,6 @@ "aws-config", "aws-sdk-dynamodb", "aws-sdk-s3", - "aws-types", "chrono", "clap", "comm-services-lib", diff --git a/services/blob/Cargo.toml b/services/blob/Cargo.toml --- a/services/blob/Cargo.toml +++ b/services/blob/Cargo.toml @@ -14,7 +14,6 @@ aws-config = "0.55" aws-sdk-dynamodb = "0.27" aws-sdk-s3 = "0.27" -aws-types = "0.55.2" chrono = "0.4" clap = { version = "4.0", features = ["derive", "env"] } comm-services-lib = { path = "../comm-services-lib", features = ["http"] } diff --git a/services/blob/src/config.rs b/services/blob/src/config.rs --- a/services/blob/src/config.rs +++ b/services/blob/src/config.rs @@ -39,7 +39,7 @@ } /// Provides region/credentials configuration for AWS SDKs -pub async fn load_aws_config() -> aws_types::SdkConfig { +pub async fn load_aws_config() -> aws_config::SdkConfig { let mut config_builder = aws_config::from_env(); if let Some(endpoint) = &CONFIG.localstack_endpoint { diff --git a/services/blob/src/database/client.rs b/services/blob/src/database/client.rs --- a/services/blob/src/database/client.rs +++ b/services/blob/src/database/client.rs @@ -5,7 +5,7 @@ }; use chrono::Utc; use comm_services_lib::database::TryFromAttribute; -use std::{collections::HashMap, sync::Arc}; +use std::collections::HashMap; use tracing::{debug, error, trace}; use crate::constants::db::*; @@ -15,14 +15,14 @@ #[derive(Clone)] pub struct DatabaseClient { - ddb: Arc, + ddb: aws_sdk_dynamodb::Client, } /// public interface implementation impl DatabaseClient { - pub fn new(aws_config: &aws_types::SdkConfig) -> Self { + pub fn new(aws_config: &aws_config::SdkConfig) -> Self { DatabaseClient { - ddb: Arc::new(aws_sdk_dynamodb::Client::new(aws_config)), + ddb: aws_sdk_dynamodb::Client::new(aws_config), } } @@ -122,7 +122,7 @@ // delete the holder row let assignment_key = PrimaryKey { blob_hash: blob_hash.clone(), - holder: holder.into(), + holder, }; let delete_request = Delete::builder() .table_name(BLOB_TABLE_NAME) @@ -211,7 +211,7 @@ } }) .collect::, _>>() - .map_err(|err| DBError::Attribute(err)) + .map_err(DBError::Attribute) } } diff --git a/services/blob/src/s3.rs b/services/blob/src/s3.rs --- a/services/blob/src/s3.rs +++ b/services/blob/src/s3.rs @@ -4,10 +4,7 @@ types::{CompletedMultipartUpload, CompletedPart}, Error as S3Error, }; -use std::{ - ops::{Bound, RangeBounds}, - sync::Arc, -}; +use std::ops::{Bound, RangeBounds}; use tracing::{debug, error, trace}; #[derive( @@ -100,17 +97,17 @@ #[derive(Clone)] pub struct S3Client { - client: Arc, + client: aws_sdk_s3::Client, } impl S3Client { - pub fn new(aws_config: &aws_types::SdkConfig) -> Self { + pub fn new(aws_config: &aws_config::SdkConfig) -> Self { let s3_config = aws_sdk_s3::config::Builder::from(aws_config) // localstack doesn't support virtual addressing .force_path_style(crate::config::CONFIG.localstack_endpoint.is_some()) .build(); S3Client { - client: Arc::new(aws_sdk_s3::Client::from_conf(s3_config)), + client: aws_sdk_s3::Client::from_conf(s3_config), } } @@ -204,7 +201,7 @@ /// Represents a multipart upload session to the AWS S3 pub struct MultiPartUploadSession { - client: Arc, + client: aws_sdk_s3::Client, bucket_name: String, object_name: String, upload_id: String, @@ -215,7 +212,7 @@ /// Starts a new upload session and returns its instance /// Don't call this directly, use [`S3Client::start_upload_session()`] instead async fn start( - client: &Arc, + client: &aws_sdk_s3::Client, s3_path: &S3Path, ) -> S3Result { let multipart_upload_res: CreateMultipartUploadOutput = client