-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add convenience methods for getting the storage size of existing offline resources #5580
Comments
That algorithm would double count resources that were shared by two packs. I agree there should be a method for getting aggregate statistics. I'm not sure what you mean by "individual offline regions" -- this API already exists, and is likely as convenient as possible given the asynchronous nature of offline. Note that any aggregate statistic API would also be asynchronous. |
We could implement this API at the SDK level, more or less, by returning the file size of cache.db, which we already know the location of. It’d include any space taken up by ambient caching (which can overlap with offline packs). |
Right, that’s essentially the singular version of steps 1 through 4. It may not be that the underlying API can be improved, but it would be nice if we could abstract the multilayered KVO grunt work — perhaps by providing completion blocks on the async methods. |
#5585 implements the synchronous API proposed in #5580 (comment) on iOS and macOS. Even if the cache’s file size differs from the size you’d get by enumerating the offline packs’ statuses, I think the former is what a developer would generally be interested in anyways. |
I think we should hold out for a database-query based API, which would provide resource and tile counts in addition to total size, which people have been asking for. |
A more granular API for resource and tile counts would certainly be desirable. However, I think the API added in #5585 is valuable on its own, not least because it’s synchronous. |
Added a property to MGLOfflineStorage that indicates the disk space occupied by all cached and offline resources. Fixes #5580.
Leaving this ticket open for both platforms in light of #5580 (comment). |
We left this issue open for #5580 (comment), but I think #9460 better covers that feature now. |
If we're going to conflate this with #9460, we should at least do some issue retitling and / or description editing. The way they are currently described, they are distinct: this issue is about getting the total size (in bytes) of all resources in an offline region (or potentially broken down by resource type). #9460 is about getting the total number of tiles for a region (and for the use case described there, preferably before committing to downloading those tiles). |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
We should provide convenience methods for getting the total stored size of offline resources — both for individual offline regions and the aggregate.
As of iOS v3.3.0, to calculate the total size of all available offline resources, you would:
packs
property./cc @1ec5 @jfirebaugh @zugaldia
The text was updated successfully, but these errors were encountered: