Skip to content

Commit

Permalink
Add UsageDetails dictionary.
Browse files Browse the repository at this point in the history
    squash 47187f6 Address style nits from domenic.
    squash 0fd3b44 Explicitly define each storage system's usage.
  • Loading branch information
Jarryd Goodman committed May 3, 2019
1 parent 725373f commit 56dc8be
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions storage.bs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ these APIs by defining:
<ul class=brief>
<li>A bucket, the primitive these APIs store their data in
<li>A way of making that bucket persistent
<li>A way of getting usage and quota estimates for an <a for=/>origin</a>
<li>A way of getting usage, quota, and per-system usage estimates for an <a for=/>origin</a>
</ul>

<p>Traditionally, as the user runs out of storage space on their device, the data stored with these
Expand Down Expand Up @@ -178,7 +178,18 @@ larger <a>site storage quota</a>. Factors such as navigation frequency, recency
bookmarking, and <a href="#persistence">permission</a> for {{"persistent-storage"}} can be used as
indications of "popularity".

The <dfn export>application cache site storage usage</dfn> for an origin is a rough estimate of the amount
of bytes used in Application Cache in <var>origin</var>'s <a>site storage unit</a>. [[HTML#appcache]]

The <dfn export>caches site storage usage</dfn> for an origin is a rough estimate of the amount
of bytes used in Cache API in <var>origin</var>'s <a>site storage unit</a>. [[service-workers-1#cache-objects]]

The <dfn export>indexedDB site storage usage</dfn> for an origin is a rough estimate of the amount
of bytes used in IndexedDB in <var>origin</var>'s <a>site storage unit</a>. [[IndexedDB]]

The <dfn export>service worker registration site storage usage</dfn> for an origin is a rough
estimate of the amount of bytes used in service worker registrations in <var>origin</var>'s
<a>site storage unit</a>. [[service-workers-1]]

<h2 id=ui-guidelines>User Interface Guidelines</h2>

Expand Down Expand Up @@ -234,7 +245,16 @@ interface StorageManager {
dictionary StorageEstimate {
unsigned long long usage;
unsigned long long quota;
StorageUsageDetails usageDetails;
};

dictionary StorageUsageDetails {
unsigned long long applicationCache;
unsigned long long caches;
unsigned long long indexedDB;
unsigned long long serviceWorkerRegistrations;
};

</pre>

The <dfn method for=StorageManager><code>persisted()</code></dfn> method, when invoked, must run
Expand Down Expand Up @@ -331,8 +351,26 @@ must run these steps:

<li><p>Let <var>quota</var> be <a>site storage quota</a> for <var>origin</var>.

<li><p>Let <var>dictionary</var> be a new {{StorageEstimate}} dictionary whose {{usage}} member
is <var>usage</var> and {{quota}} member is <var>quota</var>.
<li><p>Let <var>applicationCache</var> be <a>application cache site storage usage</a>
for <var>origin</var>.

<li><p>Let <var>indexedDB</var> be <a>indexedDB site storage usage</a> for <var>origin</var>.

<li><p>Let <var>caches</var> be <a>caches site storage usage</a> for <var>origin</var>.

<li><p>Let <var>serviceWorkerRegistrations</var> be <a>service worker registration
site storage usage</a> for <var>origin</var>.

<li><p>Let <var>usageDetails</var> be a new {{StorageUsageDetails}} dictionary
whose {{StorageUsageDetails/applicationCache}} member is <var>applicationCache</var>,
{{StorageUsageDetails/indexedDB}} member is <var>indexedDB</var>, {{StorageUsageDetails/caches}}
member is <var>caches</var>, and {{StorageUsageDetails/serviceWorkerRegistrations}} member is
<var>serviceWorkerRegistrations</var>. Any member for which the <a>site storage usage</a>
is less than 0 should be excluded from the {{StorageUsageDetails}} dictionary.

<li><p>Let <var>dictionary</var> be a new {{StorageEstimate}} dictionary whose {{StorageEstimate/usage}} member
is <var>usage</var>, {{StorageEstimate/quota}} member is <var>quota</var> and {{usageDetails}}
member is <var>usageDetails</var>.

<li>
<p>If there was an internal error while obtaining <var>usage</var> and <var>quota</var>, then
Expand Down

0 comments on commit 56dc8be

Please sign in to comment.