[Features] Support for pluggable session persistence storages #185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This rewrites session persistence entirely.
Previously it was a single JSON file hardcoded into session and flushed periodically. Now it's abstracted away and you can e.g. connect Postgres or whatever as session storage.
The only supported storage now is a folder where the database is a JSON file, and torrent bytes are stored as separate files.
It also causes some backwards incompatibility, esp. in the API layer, however the previous persistence format is tried to be preserved at least so that if you run it on top of existing file it would still remember the torrents you had previously added.
The main motivation was that storing torrent bytes into a single JSON file wasn't ideal esp. considering the file was flushed to disk every 10 seconds in a blocking manner.
And I wanted to store torrent bytes in it considering all the other recent changes that were made.