Skip to content

Commit 8a119d2

Browse files
committed
Add the ability for bottles to have a quota
And use this to port HTML's 5 MiB suggestion. See #95.
1 parent 3656181 commit 8a119d2

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

storage.bs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,18 @@ allow for different storage policies. And lastly, a <a>storage bucket</a> consis
138138
<h3 id=storage-endpoints>Storage endpoints</h3>
139139

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

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

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

150+
<p>A <a>storage endpoint</a> also has a <dfn for="storage endpoint">quota</dfn>, which is a number
151+
representing a recommended <a for=/>storage bottle</a>'s <a for="storage bottle">quota</a>.
152+
150153
<p>A <dfn>storage identifier</dfn> is an <a for=/>ASCII string</a>.
151154

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

161164
<table>
162165
<tr>
163-
<th><a>Storage identifier</a>
164-
<th><a>Storage types</a>
166+
<th><a for="storage endpoint">Identifier</a>
167+
<th><a for="storage endpoint">Type</a>
168+
<th><a for="storage endpoint">Quota</a>
165169
<tr>
166170
<td>"<code>caches</code>"
167171
<td>« "<code>local</code>" »
172+
<td>null
168173
<tr>
169174
<td>"<code>indexedDB</code>"
170175
<td>« "<code>local</code>" »
176+
<td>null
171177
<tr>
172178
<td>"<code>localStorage</code>"
173179
<td>« "<code>local</code>" »
180+
<td>5 &times; 2<sup>20</sup> (i.e., 5 mebibytes)
174181
<tr>
175182
<td>"<code>serviceWorkerRegistrations</code>"
176183
<td>« "<code>local</code>" »
184+
<td>null
177185
<tr>
178186
<td>"<code>sessionStorage</code>"
179187
<td>« "<code>session</code>" »
188+
<td>5 &times; 2<sup>20</sup> (i.e., 5 mebibytes)
180189
</table>
181190

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

305315
<li><p>Return <var>bucket</var>.
306316
</ol>
@@ -312,7 +322,10 @@ steps:
312322
<a>storage endpoint</a>. A <a>storage bottle</a> has a <dfn for="storage bottle">map</dfn>, which is
313323
initially an empty <a for=/>map</a>. A <a>storage bottle</a> also has a
314324
<dfn for="storage bottle">proxy map reference set</dfn>, which is initially an empty
315-
<a for=/>set</a>.
325+
<a for=/>set</a>. A <a>storage bottle</a> also has a <dfn for="storage bottle">quota</dfn>, which is
326+
null or a number representing a conservative estimate of the amount of bytes available to it. Null
327+
indicates the lack of a limit. <span class=note>It is still bound by the <a>storage quota</a> of its
328+
encompassing <a for=/>storage shelf</a>.
316329

317330
<p>A <a>storage bottle</a>'s <a for="storage bottle">map</a> is where the actual data meant to be
318331
stored lives. User agents are expected to store this data, and make it available across <a>agent</a>

0 commit comments

Comments
 (0)