Skip to content

Commit

Permalink
fix : deepsource doc recommendation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Jangra authored and Arun Jangra committed Jun 26, 2024
1 parent e2d4cf8 commit e6e3f10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/orchestrator/src/data_storage/aws_s3/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ use crate::data_storage::DataStorageConfig;

/// Represents AWS S3 config struct with all the necessary variables.
pub struct AWSS3Config {
/// AWS ACCESS KEY ID
pub s3_key_id: String,
/// AWS ACCESS KEY SECRET
pub s3_key_secret: String,
/// S3 Bucket Name
pub s3_bucket_name: String,
/// S3 Bucket region
pub s3_bucket_region: String,
}

Expand Down
5 changes: 5 additions & 0 deletions crates/orchestrator/src/data_storage/aws_s3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@ impl AWSS3 {
}
}

/// Implementation of `DataStorage` for `AWSS3`
/// contains the function for getting the data and putting the data
/// by taking the key as an argument.
#[async_trait]
impl DataStorage for AWSS3 {
/// Function to get the data from S3 bucket by Key.
async fn get_data(&self, key: &str) -> Result<Bytes, Error> {
let response = self.client.get_object().bucket(self.config.s3_bucket_name.clone()).key(key).send().await?;
let data_stream = response.body.collect().await.expect("Failed to convert body into AggregatedBytes.");
let data_bytes = data_stream.into_bytes();
Ok(data_bytes)
}

/// Function to put the data to S3 bucket by Key.
async fn put_data(&self, data: ByteStream, key: &str) -> Result<(), Error> {
self.client
.put_object()
Expand Down

0 comments on commit e6e3f10

Please sign in to comment.