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

Resumable downloads. #84

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

Resumable downloads. #84

wants to merge 3 commits into from

Conversation

Narsil
Copy link
Collaborator

@Narsil Narsil commented Dec 27, 2024

Notes on the strategy here.

Sync:

  • Relatively straigforward, we're not multiplexing, we write in order, therefore we can simply pick up whereever we left off.

Tokio:
Since we're multiplexing, writes are not happening in order. We could:

  • Store every written interval and skip those, but that involves creating somewhat complex datastructures.
  • Instead, since writes are mostly ordered, we simply commit whatever was fully written as a single u64 at the very end of the partial file. When resuming, we read that single int, and resume from there. Anything fishy and we drop the resumability.

This feels simpler that the more complex version, seems to work quite well in practice (only tested on stable networks right now).
The probability for storing invalid files seems low (since commit happens at a single location both in code and in file).

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.

1 participant