Expire artifacts in local cache
The local artifact cache is currently unbounded and needs to periodically be cleaned by the user with something like:
rm -rf ~/.cache/buildstream/artifacts
This is not ideal because it will delete everything.
Instead, we should have a user configurable quota, allowing the user to restrict the artifact cache from growing beyond a given size.
This can be imlemented using a least-recently-used algorithm, where artifacts which have not been used for a long time are expired from the local cache first when buildstream is creating artifacts.
Complications and edge cases:
- BuildStream should not expire artifacts which are required in the current build plan
- In interactive mode, in the case that the local cache is too small to fit a given build, the user needs to be asked what to do
- This decision should probably carry for the remainder of the build, if the user decided to make an exception and allow the cache to grow beyond the quota, then they probably dont want to re-answer this question for every build
- In non-interactive mode, a decision needs to be made in advance, perhaps it is simply disallowed to ever grow
- In the cases where local artifact quota exceeds the amount of remaining disk space for the given partition/volume, something smart needs to be done
- On startup, a warning should be issued
- The remaining space, minus some hard coded reasonable value, should probably be considered instead of the user defined quota for the duration of the session