Limit navmesh disk cache size
Based on a discussion starting with !1058 (comment 676466233).
In short the reasoning behind this is that we don't want openmw to take all space on users disk to write navmesh cache. And I consider this as a blocker to make write to navmeshdb = true
default.
As a start simple limit without eviction policy should be good enough. If openmw or navmeshtool reaches this limit it just writes a warning to the log. The engine should do this no more than once per process lifetime. Navmeshtool should fail with an error.
There are multiple ways how we can measure cache size:
- Check file size.
- Use SQLite3 queries:
pragma page_count;
pragma page_size;
- Query for tables content size:
SELECT sum(length(data)) FROM tiles;
1 and 2 should give the same number. 1 should give more confidence and less probablility of failure. 2 doesn't require any new API to use. 3 can be very different from how much disk space is used and maybe can be used to perform occasional vaccuum in combination with 1 and 2.