Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability for bottles to have a quota #97

Merged
merged 2 commits into from
Jun 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions storage.bs
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,19 @@ allow for different storage policies. And lastly, a <a>storage bucket</a> consis
<h3 id=storage-endpoints>Storage endpoints</h3>

<p>A <dfn export>storage endpoint</dfn> is a <a lt="local storage">local</a> or
<a>session storage</a> API that uses the infrastructure defined by this standard to keep track of
its storage needs.
<a>session storage</a> API that uses the infrastructure defined by this standard, most notably
<a for=/>storage bottles</a>, to keep track of its storage needs.

<p>A <a>storage endpoint</a> has an <dfn for="storage endpoint">identifier</dfn>, which is a
<a>storage identifier</a>.

<p>A <a>storage endpoint</a> also has <dfn for="storage endpoint">types</dfn>, which is a
<a for=/>set</a> of <a>storage types</a>.

<p>A <a>storage endpoint</a> also has a <dfn for="storage endpoint">quota</dfn>, which is null or a
number representing a recommended <a for="storage bottle">quota</a> (in bytes) for all
<a for=/>storage bottles</a> corresponding to this <a>storage endpoint</a>.

<p>A <dfn>storage identifier</dfn> is an <a for=/>ASCII string</a>.

<p>A <dfn>storage type</dfn> is "<code>local</code>" or "<code>session</code>".
Expand All @@ -160,23 +164,29 @@ defined by the following table:

<table>
<tr>
<th><a>Storage identifier</a>
<th><a>Storage types</a>
<th><a for="storage endpoint">Identifier</a>
<th><a for="storage endpoint">Type</a>
<th><a for="storage endpoint">Quota</a>
<tr>
<td>"<code>caches</code>"
<td>« "<code>local</code>" »
<td>null
<tr>
<td>"<code>indexedDB</code>"
<td>« "<code>local</code>" »
<td>null
<tr>
<td>"<code>localStorage</code>"
<td>« "<code>local</code>" »
<td>5 &times; 2<sup>20</sup> (i.e., 5 mebibytes)
<tr>
<td>"<code>serviceWorkerRegistrations</code>"
<td>« "<code>local</code>" »
<td>null
<tr>
<td>"<code>sessionStorage</code>"
<td>« "<code>session</code>" »
<td>5 &times; 2<sup>20</sup> (i.e., 5 mebibytes)
</table>

<p class=note>As mentioned, standards can use these <a>storage identifiers</a> with
Expand Down Expand Up @@ -300,7 +310,8 @@ steps:
<li><p><a for=set>For each</a> <var>endpoint</var> of <a>registered storage endpoints</a> whose
<a for="storage endpoint">types</a> <a for=set>contain</a> <var>type</var>, set <var>bucket</var>'s
<a>bottle map</a>[<var>endpoint</var>'s <a for="storage endpoint">identifier</a>] to a new
<a>storage bottle</a>.
<a>storage bottle</a> whose <a for="storage bottle">quota</a> is <var>endpoint</var>'s
<a for="storage endpoint">quota</a>.

<li><p>Return <var>bucket</var>.
</ol>
Expand All @@ -312,7 +323,10 @@ steps:
<a>storage endpoint</a>. A <a>storage bottle</a> has a <dfn for="storage bottle">map</dfn>, which is
initially an empty <a for=/>map</a>. A <a>storage bottle</a> also has a
<dfn for="storage bottle">proxy map reference set</dfn>, which is initially an empty
<a for=/>set</a>.
<a for=/>set</a>. A <a>storage bottle</a> also has a <dfn for="storage bottle">quota</dfn>, which is
null or a number representing a conservative estimate of the total amount of bytes it can hold. Null
indicates the lack of a limit. <span class=note>It is still bound by the <a>storage quota</a> of its
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline notes? Sorcery!

encompassing <a for=/>storage shelf</a>.

<p>A <a>storage bottle</a>'s <a for="storage bottle">map</a> is where the actual data meant to be
stored lives. User agents are expected to store this data, and make it available across <a>agent</a>
Expand Down Expand Up @@ -427,7 +441,7 @@ deduplication, compression, and other techniques that obscure exactly how much b
<a>storage shelf</a> uses.

<p>The <dfn export>storage quota</dfn> of a <a>storage shelf</a> is a conservative estimate of the
amount of bytes available to it. This amount should be less than the total available storage space
total amount of bytes it can hold. This amount should be less than the total available storage space
on the device to give users some wiggle room.

<p class=note>User agents are strongly encouraged to consider navigation frequency, recency of
Expand Down