-
Notifications
You must be signed in to change notification settings - Fork 0
Basic modules in MindDrop
Every user has a files key in their dictionary, it is an array containing all the file-uuid the user uploaded. when login to the web interface for file checking, all the files are grasped base on the 'files' uuid list. In this case, we have to do two query because of the design of mongodb.
Every time a file is uploaded, the size is deducted from user dictionary, and every time the user delete a cloud file or the file is self-destructed, the size of that file is added back to user dictionary.
Currently, if you upload a file with size bigger than current available size (e.g you have 1G free but you are uploading a 1.2G file), the file will still be uploaded, as long as your disk free space is less than 0 (deduction based), you can't upload anymore files.
Every another hour, the cron task is going to check for outdated files (self-destruct in v0.2.0 beta), and all outdated files will be moved both from hard-disk and database. When accessing this file again using the url, it will redirect to a file-not-found page.
The cutoff time for deletion is calculated using moment.js.
Every upload authenticates whether the user is of the session last time he/she logged in. The session is also generated based on uuid v4.