Skip to content

Commit

Permalink
feat : added comments for functions and impls as suggested by deepsource
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 568bae4 commit e2d4cf8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/orchestrator/src/data_storage/aws_s3/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ use utils::env_utils::get_env_var_or_panic;

use crate::data_storage::DataStorageConfig;

/// Represents AWS S3 config struct with all the necessary variables.
pub struct AWSS3Config {
pub s3_key_id: String,
pub s3_key_secret: String,
pub s3_bucket_name: String,
pub s3_bucket_region: String,
}

/// Implementation of `DataStorageConfig` for `AWSS3Config`
impl DataStorageConfig for AWSS3Config {
/// To return the config struct by creating it from the environment variables.
fn new_from_env() -> Self {
Self {
s3_key_id: get_env_var_or_panic("AWS_ACCESS_KEY_ID"),
Expand Down
7 changes: 7 additions & 0 deletions crates/orchestrator/src/data_storage/aws_s3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ use aws_sdk_s3::primitives::ByteStream;
use aws_sdk_s3::{Client, Error};
use bytes::Bytes;

/// Module for AWS S3 config structs and implementations
pub mod config;

/// AWSS3 represents AWS S3 client object containing the client and the config itself.
pub struct AWSS3 {
client: Client,
config: AWSS3Config,
}

/// Implementation for AWS S3 client. Contains the function for :
///
/// - initializing a new AWS S3 client
impl AWSS3 {
/// Initializes a new AWS S3 client by passing the config
/// and returning it.
#[allow(dead_code)]
pub async fn new(config: AWSS3Config) -> Self {
// AWS cred building
Expand Down
4 changes: 4 additions & 0 deletions crates/orchestrator/src/data_storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ pub trait DataStorage: Send + Sync {
async fn put_data(&self, data: ByteStream, key: &str) -> Result<(), Error>;
}

/// **DataStorageConfig** : Trait method to represent the config struct needed for
/// initialisation of data storage client
pub trait DataStorageConfig {
/// Get a config file from environment vars in system or
/// dotenv file.
fn new_from_env() -> Self;
}
3 changes: 3 additions & 0 deletions crates/orchestrator/src/data_storage/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use cairo_vm::Felt252;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// This struct represents the contract changes that will be in `StarknetOsOutput`
/// as a vector.
#[derive(Debug, Deserialize, Serialize)]
pub struct ContractChanges {
/// The address of the contract.
Expand All @@ -14,6 +16,7 @@ pub struct ContractChanges {
pub storage_changes: HashMap<Felt252, Felt252>,
}

/// This struct represents the starknet OS outputs in the json we will get after the run.
#[derive(Debug, Deserialize, Serialize)]
pub struct StarknetOsOutput {
/// The root before.
Expand Down

0 comments on commit e2d4cf8

Please sign in to comment.