The aim of this document is to outline our expected use cases for a DB in the context of account handling. The purpose of that is to set the parameters we care about, so we can proceed to testing and benchmarking different DB solutions against those parameters. The end goal is to select the best tool for the job.
Preliminary Discord discussion: https://discordapp.com/channels/542938080349519882/678951497064775702/748088955399962684
- We need a distributed DB that can be part of our standard node setup, either as a stand-alone application or as part of
- It needs a fast and reliable synchronization mechanism, so the changes propagate quickly (see user story 1]).
- It needs to be resilient to loss of nodes (lack of quorum, split-brain, etc.).
- Adding new nodes should be automatic/automatable and pain-free.
Data and actions on it
- Premium users
- which skyfiles are pinned by the user?
- Pinned skyfiles
- how many total users pin the file?
- how many premium users pin the file?
- which (list) premium users list the file?
- last download timestamp
- Premium referrers (any request coming from a premium referrer is treated as a premium user request and the referrer pays)
- Is this user pinning this file?
- List all files pinned by a user.
- List all users pinning a file.
- List all files that are not being pinned anymore. Then delete them.
- When removing a premium user/referrer we need to be able to loop over all files pinned by them and adjust their stats accordingly.
1. User's internet connection gets interrupted:
- user wants to watch a premium movie
- user pays for the movie (the LB has directed the user to
- user's internet connection drops, so their router falls back on their second connection
- user is now redirected to
germanydoesn't know that the user has already paid, so it tries to charge their account again
- the account's limit is reached and the user is denied access to the premium movie
- We should be able to regularly back up the DB and then restore it in case of an incident. An incident might be data corruption caused by a bug/outage/etc. or bad data inserted by an attacker.