-
Notifications
You must be signed in to change notification settings - Fork 45
feat: cleanup unexpected files in immutable folder after download #2502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cleanup unexpected files in immutable folder after download #2502
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new two-phase tool in mithril-client to compute the expected state of the immutable folder and remove any unexpected files after snapshot download, while logging file offenders.
- Introduces the new module UnexpectedDownloadedFileVerifier in the utils package.
- Modifies snapshot_client and internal_downloader to incorporate file removal after download (even in error cases).
- Adjusts module exports and download routines to include ancillary verification and unexpected file cleanup.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
mithril-client/src/utils/mod.rs | New module unexpected_downloaded_file_verifier added and re-exported to support file cleanup. |
mithril-client/src/snapshot_client.rs | Updated download and unpack routines to compute expected file state, remove unexpected files, and conditionally download ancillary files. |
mithril-client/src/cardano_database_client/download_unpack/internal_downloader.rs | Adjusted the download task flow to compute the expected state and remove unexpected files even if downloads fail. |
Comments suppressed due to low confidence (1)
mithril-client/src/snapshot_client.rs:241
- [nitpick] Consider adding a comment explaining that the removal step is deliberately executed even if the download fails, to clarify intended behavior for future maintainers.
expected_files_after_download.remove_unexpected_files().await?;
mithril-client/src/cardano_database_client/download_unpack/internal_downloader.rs
Show resolved
Hide resolved
324a0ba
to
364e497
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
mithril-client/src/utils/unexpected_downloaded_file_verifier.rs
Outdated
Show resolved
Hide resolved
A two stages tools that first compute the expected state of a cardano database immutable folder after download, then after said download is done remove all unexpected files.
…root And take in account the fact that directories (root or immutable) could not exist before download.
…ames instead of working on full path
…work on non existing dir As the download step may have not been able to create them because of a failure.
* mithril-client from `0.12.5` to `0.12.6`
364e497
to
1f4b4d7
Compare
Content
This PR add a two phase tool in the
mithril-client
that:The removal is executed even if the download fail.
caveats
Pre-submit checklist
Issue(s)
Closes #2429