ubsicap / sltt-app

0 stars 0 forks source link

feat(sltt-app): disk space management needed #19

Open ericpyle opened 3 months ago

ericpyle commented 3 months ago

PROBLEM: Currently when sltt-app is connected to the user's local disk for "LAN storage" sltt-app will store all the videos that the user ever downloads without trying to delete them at any point. Eventually the user will probably run out of disk space

SOLUTION1: use electron's fs capabilities to probe the capacity of the volume that is connected to LAN and the and warn the user

SOLUTION2: Do nothing and let the operating system warn the user about need to cleanup

CURRENT WORKAROUND: if the user connects their lan to their sltt user data directory and then manually uninstalls the app then it will remove all the videos and project docs from disk. Anything not backed up will be gone forever, but they will have more disk space.

---- older suggestions: The client sltt-pwa uses makeSpaceAvailable() to free up video cache space when usage reaches a certain percentage of quota. We probably need to do something like that for disk management for the standalone.

One possibility: We may need to use the makeSpaceAvailable() code in the sltt-pwa client for helping to manage sltt-app disk space as well, or we may be able to re-implement some of that code in electron without the client knowing about it.

Currently sltt-pwa has a hard quota of 10GB even if the browser says more is available. From one point of view, the standalone could use a much smaller hard-quota since it can fetch videos from the disk that have been removed from the cache. It's possible that the standalone doesn't need a video cache at all (but I imagine that could lead to a lot of code changes).

We need to remember however, that the StorageLimitStatus warning is based on 2GB minimum for quota and for difference between quota and usage. So if we set a low-hard-quota for the cache, we need to adjust for standalone context.

Question: makeSpaceAvailable() only cleans up videos that have been backed up online. What do we do if the video cache or disk videos that haven't been backed up take up too much space on their hard disk? At the very least, perhaps we should have an Error that says something like "SLTT cannot save any more videos because SLTT cannot safely remove videos that have not been backed up online."