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 --no-prefetch flag to disable downloading the whole torrent #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tilo15
Copy link

@Tilo15 Tilo15 commented Jan 4, 2024

I've been playing with making peer-to-peer software repositories for DNF/RPM. This tool is very useful since I can create a torrent of my repository and mount it to make the repo accessible to the package manager.

I noticed in #72 that btfs by design downloads the whole torrent. In my use case, I only want the files that the package manager needs to read to be downloaded from the torrent, and it seems from that issue that other users may have similar use cases.

In this pull request I have added the --no-prefetch flag which when used changes the behaviour of btfs in the following ways:

  1. Sets all files to priority 0 in the setup() function.
  2. Sets a file to priority 1 when read.
  3. Sets the pieces that are requested in the read to priority 7

This means that once a file is partly read, pieces of that file only will be downloaded in the background, but the priority will still be on the parts of the file the application requested from the filesystem.

Thank you for your time and consideration.

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