Skip to content

Commit

Permalink
fix: Implement missing S3 object naming conventions (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Mar 25, 2022
1 parent 10c0ad4 commit 812b254
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/sinks/aws_lambda/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ impl SinkProvider for WithUtils<Config> {
let retry_config = RetryConfig::new()
.with_max_attempts(self.inner.max_retries.unwrap_or(DEFAULT_MAX_RETRIES));

let sqs_config = aws_sdk_lambda::config::Builder::from(&aws_config)
let lambda_config = aws_sdk_lambda::config::Builder::from(&aws_config)
.retry_config(retry_config)
.build();

let client = Client::from_conf(sqs_config);
let client = Client::from_conf(lambda_config);
let function_name = self.inner.function_name.clone();

let utils = self.utils.clone();
Expand Down
25 changes: 22 additions & 3 deletions src/sinks/aws_s3/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,28 @@ fn define_obj_key(prefix: &str, policy: &Naming, record: &BlockRecord) -> String
Naming::Hash => format!("{}{}", prefix, record.hash),
Naming::SlotHash => format!("{}{}.{}", prefix, record.slot, record.hash),
Naming::BlockHash => format!("{}{}.{}", prefix, record.number, record.hash),
Naming::EpochHash => todo!(),
Naming::EpochSlotHash => todo!(),
Naming::EpochBlockHash => todo!(),
Naming::EpochHash => format!(
"{}{}.{}",
prefix,
record.epoch.unwrap_or_default(),
record.hash
),
Naming::EpochSlotHash => format!(
"{}{}.{}.{}",
prefix,
record.epoch.unwrap_or_default(),
record.slot,
record.hash
),
Naming::EpochBlockHash => {
format!(
"{}{}.{}.{}",
prefix,
record.epoch.unwrap_or_default(),
record.number,
record.hash
)
}
}
}

Expand Down

0 comments on commit 812b254

Please sign in to comment.