Skip to content

Commit

Permalink
chore: if epoch is missing, log which one
Browse files Browse the repository at this point in the history
  • Loading branch information
carver committed Oct 22, 2024
1 parent 454b3e0 commit 531b0e1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions e2store/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ pub async fn download_era_links(
pub async fn get_era_files(http_client: &Client) -> anyhow::Result<HashMap<u64, String>> {
let era_files = download_era_links(http_client, ERA_DIR_URL).await?;
ensure!(!era_files.is_empty(), "No era files found at {ERA_DIR_URL}");
ensure!(
(0..era_files.len()).all(|epoch| era_files.contains_key(&(epoch as u64))),
"Epoch indices are not starting from zero or not consecutive",
);
for epoch_num in 0..era_files.len() {
ensure!(
era_files.contains_key(&(epoch_num as u64)),
"Epoch indices are not starting from zero or not consecutive: missing epoch {epoch_num}",
);
}
Ok(era_files)
}

Expand Down

0 comments on commit 531b0e1

Please sign in to comment.