Skip to content
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

add clean_file_from_url #165

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

add clean_file_from_url #165

wants to merge 3 commits into from

Conversation

assafvayner
Copy link
Contributor

Adds a utility function to clean a file given a url to use to "GET" the file, i.e. an S3 presigned url.

The contents are then read incrementally and passed into the cleaner handle to chunk, dedup and upload.

Intended potential use for streaming files to migrate them.

@assafvayner assafvayner requested review from seanses and sirahd February 4, 2025 19:08
let path = PathBuf::from(path);
let mut read_buf = vec![0u8; READ_BLOCK_SIZE];

let response = reqwest::get(file_url).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our build_http_client can build a client with retry capability.

.await?;

loop {
let bytes = reader.read(&mut read_buf).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm not sure how does the RetryMiddleware works with stream reading. If an error occurs within this read() does the RetryMiddleware retries this read or the entire GET? If it retries the entire GET what does the next successful read return? If it returns bytes from the beginning of the file then that's problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants