Add local cache expiry documentation and fix misleading error message when specifying a percentage cache quota
This patch aims to partially solve #700 by adding a section of to the documentation showing how we set local cache quotas in our user configuration.
It also fixes a misleading error message which occurs if your disk space quota (in %) exceeds the available disk space on the file system which contains the cache.
Output examples below:
Before this patch:
$ cat ~/.config/buildstream.conf
cache:
quota: 90%
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cryptAntergos 432G 47G 363G 12% /
$ bst build hello.bst
Error instantiating artifact cache: Your system does not have enough available space to support the cache quota specified.
You currently have:
- 8G of cache in use at /home/jennis/.cache/buildstream/artifacts
- 363G of available system storage
Clearly the above error is not true, I have 363G left. I think the intended behaviour is to say "Start cleaning once my disk space hits that percentage".
After this patch:
$ cat ~/.config/buildstream.conf
cache:
quota: 90%
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cryptAntergos 432G 48G 362G 12% /
$ bst build hello.bst
Error instantiating artifact cache: Your system does not have enough available space to support the cache quota specified.
You have specified a quota of 90% of total disk space.
- The filesystem containing /home/jennis/.cache/buildstream/artifacts only has: 83.8% of total disk space available.