johang/btfs

[FR] Add multiple torrent support

hazcod opened this issue · 7 comments

Would be nice if it would be possible to mount multiple torrents. (e.g. out of a sqlite database)

You can run multiple instances of btfs simultaneously, like this:

$ mkdir mnt1 mnt2 mnt3
$ btfs a.torrent mnt1
$ btfs b.torrent mnt2
$ btfs c.torrent mnt3

Bam! Multiple torrents mounted.

but wouldn't this bring along a massive overhead for large amounts? (e.g. keeping 200+ connections to the swarm, being on the peerlists ALL the time, ..)

If you plan to run hundreds of torrents, maybe this is not the right tool...

I wonder if it would be possible to fetch & cache metadata, shut down the torrent clients and only open one up if needed would be a good idea.

EDIT: I see you have --browse-only, will it shut down connections after that? An extra option --on-read would be nice to only fire it up when readfile is requested.

I don't feel like bloating the code base with lots of logic for handling multiple torrents or logic to open and close downloads based on various events. That was never the point of this project.

An --on-read option would be a great addition. I had assumed that was the default behavior without --keep.

I've got a torrent mounted that is larger than my free space. Luckily(?) it appears to going relatively slowly.

Current strategy is to maintain a sliding window of pieces to download. That way, it will download pieces sequentially, but not strictly in order. This sliding window is moved each time an application reads somewhere (see the jump function) and each time time the first piece of the current window is finished (see the advance function.)

An option to not call advance would maybe solve your "torrent mounted that is larger than my free space" problem. The download performance will suck though.