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

Allow importing snapshot from URL + Progress bar (#762) #811

Merged
merged 6 commits into from
Nov 19, 2020

Conversation

snaumov
Copy link
Contributor

@snaumov snaumov commented Nov 5, 2020

Summary of changes
Changes introduced in this pull request:

  • Ability to import the snapshot from the remote url
  • Download progress indicator

forest

Reference issue to close (if applicable)

Closes #762

Other information and links

@snaumov snaumov force-pushed the snaumov/import-snapshot-url branch 3 times, most recently from fa9b0bb to 128af58 Compare November 5, 2020 14:13
Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

Happy to make a pass after to clean up some of these things, but the one thing that absolutely needs to change is writing to a temporary file just to read and delete it

utils/net_utils/src/download.rs Show resolved Hide resolved
utils/net_utils/src/download.rs Outdated Show resolved Hide resolved
utils/net_utils/src/download.rs Outdated Show resolved Hide resolved
forest/src/daemon.rs Outdated Show resolved Hide resolved
utils/net_utils/Cargo.toml Outdated Show resolved Hide resolved
@austinabell
Copy link
Contributor

btw, conformance test vectors are failing because you committed a previous commit of the repo to this PR

utils/net_utils/src/download.rs Outdated Show resolved Hide resolved
utils/genesis/src/lib.rs Outdated Show resolved Hide resolved
utils/genesis/src/lib.rs Outdated Show resolved Hide resolved
utils/net_utils/src/download.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

LGTM great changes, thanks for making those adjustments! One thing about this is that it doesn't add the progress bar to loading a local car file (and those imports can take a long time) but this can be easily added after this PR comes in

@snaumov
Copy link
Contributor Author

snaumov commented Nov 18, 2020

@austinabell right. I thought about this too at some point :) I can rename make_http_reader to make_reader back, and make it accept &str and check if the incoming str is a Url or local path, and depending on that either return FetchProgress that reads from url or from local file. Thoughts?

@austinabell
Copy link
Contributor

austinabell commented Nov 18, 2020

@austinabell right. I thought about this too at some point :) I can rename make_http_reader to make_reader back, and make it accept &str and check if the incoming str is a Url or local path, and depending on that either return FetchProgress that reads from url or from local file. Thoughts?

Or you can just wrap the file reader in that progress bar (capacity you can get from the file metadata). Either way should work, it's up to you. My intuition would be that the generics of the solution you suggest would be a little tricky to workaround, but it would be a slightly cleaner solution indeed

@snaumov
Copy link
Contributor Author

snaumov commented Nov 19, 2020

@austinabell right. I thought about this too at some point :) I can rename make_http_reader to make_reader back, and make it accept &str and check if the incoming str is a Url or local path, and depending on that either return FetchProgress that reads from url or from local file. Thoughts?

Or you can just wrap the file reader in that progress bar (capacity you can get from the file metadata). Either way should work, it's up to you. My intuition would be that the generics of the solution you suggest would be a little tricky to workaround, but it would be a slightly cleaner solution indeed

Updated MR, using TryFrom now instead for both File and Url.

@ec2
Copy link
Member

ec2 commented Nov 19, 2020

Looks great! Thanks as always for the contribution!!!!!!!

Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

oo very nice, thanks!

@austinabell austinabell merged commit d6c9bf6 into ChainSafe:main Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow snapshot to be loaded from an http request and add progress
3 participants