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

feat: add sqlite backend for storage #483

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

Conversation

cocool97
Copy link
Contributor

@cocool97 cocool97 commented Jan 4, 2025

This PR aims to add a SQLite backend for server storage. It is provided as a replacement of jsonDB and bboltDB. This new storage is currently registered as the default backend.

gorm (https://gorm.io/) is used as an ORM, allowing to abstract models and underlying database storage (MySQL, PostgreSQL, SQLite, SQLite server). Only SQLite is implemented in this PR.

A new parameter has also been added to server CLI, -b to continue using "legacy" storage backends.

Advantages of this new storage backend:

  • Less memory fingerprint (no information is stored in memory, everything is store on disk).
  • A complete and structured request language (SQL), providing interesting features for requests.
  • Defined models to create and migrate database

Settings are still stored in JSON format, easing the pre-configuration of the server.

This PR is needed for #421 to cache downloaded informations about films and series using TMDB api. This will prevent reaching quota by caching informations, without impact on memory consumption.

Needed steps before PR being ready:

  • Add SQLite storage
  • Store torrent
  • Store viewed information

Let me know if there is something I can do to improve this PR !

@cocool97 cocool97 marked this pull request as ready for review January 17, 2025 16:19
@cocool97
Copy link
Contributor Author

cocool97 commented Jan 17, 2025

Hey @tsynik, the core of this PR is ready for review :)
Before merging there is still an issue I need your help with. When I first load a torrent into torrserver everything is working fine client-side (web UI or android app). But after I restart the server, torrent is shown client-side but remains in "Getting torrent info" without getting file listing... Do you have an idea where this can come from ?

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