confluence
confluence copied to clipboard
Improve torrent cache
Currently all torrents are saved in one directory in the binary root. This PR will use the FileDir flag to move that directory to the user input path and separate the files using the first 3 chars of each hash.
Thanks. I think I did it like this to reduce configuration overhead: The working directory is used to determine all this stuff. Is there any reason this isn't sufficient?
There shouldn't be any further config needed. But it is a personal preference that I need to have all the cache on a mounted drive and to make sure the number of files in one directory is not too large. Feel free to close it if you disagree.
I don't see any reason to have a separate config option if the working directory thing is sufficient for now. Partitioning the torrents seems useful, I'm guessing you have a lot of them if you're having performance issues due to the DHT. I think common practice is to split with 2 to 4 hex characters at a time to achieve the desired directory fill.
This makes sense now, but I think an interface should be exposed for alternative implementations instead.
I have a fix coming for this.
This PR is a bit out of date now. I exposed MetainfoStorage which stuffs it into a squirrel.Cache. It's not perfect for all situations, but should solve your original problem.