[whatwg/storage] Proposal: Add detailed usage breakdown in estimate() (#63)

We've had a frequent request from users of `estimate()` to provide an per storage type breakdown estimation. For example, something like:
```js
{
   quota: 440922000000,
   usage: 27300000,
   details: {
     indexeddb: 676000,
     cacheapi: 26500000,
     serviceworker: 52800
   }
}
```
This stems from web apps that have supported for years and/or where multiple apps are present within an origin makes reasoning about what is using up storage difficult. Also exacerbating the problem:

* Storage APIs don't simply store bytes. There's encoding, metadata, compression, padding, and so on.
* Not all APIs allow enumeration (e.g. https://github.com/w3c/IndexedDB/issues/31)

Lots of details to figure out, but:

* Numbers would be estimates.
* No need for everything to add up to the "usage" value. There should be an understanding that there will overhead/metadata in the system.
* Would add hooks to this spec to allow other storage specs to define the key.
  * You could imagine sharing that with a more granular [Clear-Site-Data](https://www.w3.org/TR/clear-site-data/) header in the future.
* In Chrome we'd want to surface non-standard/deprecated storage type usage (specifically, file system, websql, appcache), so the spec shouldn't specifically preclude that.

In Chrome we have this plumbed through internally for our DevTools implementation:

![image](https://user-images.githubusercontent.com/771547/40860899-d59f5658-659b-11e8-804f-639b83ddee53.png)

Thoughts?



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/storage/issues/63

Received on Friday, 1 June 2018 20:04:51 UTC