@@ -60,8 +60,60 @@ different storage mechanism with a different API for such files. The entry point
60
60
61
61
## Concepts ## {#concepts}
62
62
63
+ ### File System ### {#concept-file-system}
64
+
65
+ A <dfn export>file system</dfn> is an [=implementation-defined=]
66
+ [=storage endpoint=] that maintains a mapping of [=file system path=] s to
67
+ [=file system entry|file system entries=] .
68
+
69
+ Each [=/file system=] has an associated <dfn for="file system" export>root</dfn> ,
70
+ an opaque [=string=] whose value is [=implementation-defined=] .
71
+
72
+ A <dfn export>file system path</dfn> is a [=/list=] of one or more [=strings=] .
73
+ This may be a virtual path that is mapped to real location on disk or in memory,
74
+ may correspond directly to a path on the local file system, or may not
75
+ correspond to any file on disk at all. The actual physical location of the
76
+ corresponding [=/file system entry=] is [=implementation-defined=] .
77
+
78
+ A [=/file system path=] |a| is <dfn for="file system path">the same path as</dfn>
79
+ a [=/file system path=] |b| if
80
+ |a|'s [=list/size=] is the same as |b|' s [=list/size=] and
81
+ [=list/for each=] |index| of |a|'s [=list/indices=]
82
+ |a|.\[[|index|]] is |b|.\[[|index|]] .
83
+
84
+ <div algorithm>
85
+ Each [=/file system=] has an associated
86
+ <dfn for="file system">locate an entry</dfn>
87
+ algorithm, which takes [=/file system path=] |path| and runs an
88
+ [=implementation-defined=] series of steps returning a [=file system entry=] or null.
89
+ A non-null return value |entry| must adhere to these constraints:
90
+
91
+ - [=file system/Getting the path=] with |entry| returns |path|,
92
+ provided no intermediate file system operations were run.
93
+ - |entry|'s [=file system entry/name=] is the last [=list/item=] of |path|.
94
+
95
+ </div>
96
+
97
+ <div algorithm>
98
+ Each [=/file system=] has an associated
99
+ <dfn for="file system">get the path</dfn>
100
+ algorithm, which takes [=/file system entry=] |entry| and runs an
101
+ [=implementation-defined=] series of steps returning a [=file system path=] . The
102
+ return value |path| must adhere to these constraints:
103
+
104
+ - [=file system/Locating an entry=] with |path| returns |entry|,
105
+ provided no intermediate file system operations were run.
106
+ - |entry|'s [=file system entry/name=] is the last [=list/item=] of |path|.
107
+
108
+ </div>
109
+
110
+ ### File System Entry ### {#concept-file-system-entry}
111
+
63
112
A <dfn export id="entry">file system entry</dfn> is either a [=file entry=] or a [=directory entry=] .
64
113
114
+ Each [=/file system entry=] has an associated
115
+ <dfn for="file system entry">file system</dfn> (a [=/file system=] ).
116
+
65
117
Each [=/file system entry=] has an associated
66
118
<dfn for="file system entry" id=entry-query-access>query access</dfn>
67
119
algorithm, which takes "`read`" or "`readwrite`" <var ignore> mode</var> and
@@ -200,15 +252,50 @@ A [=/file system entry=] |a| is <dfn for="file system entry">the same entry as</
200
252
a [=/file system entry=] |b| if |a| is equal to |b|, or
201
253
if |a| and |b| are backed by the same file or directory on the local file system.
202
254
255
+ ### File System Locator ### {#concept-file-system-locator}
256
+
257
+ A <dfn export>file system locator</dfn> represents a potential location of a
258
+ [=/file system entry=] . A [=/file system locator=] is either a [=file locator=]
259
+ or a [=directory locator=] .
260
+
261
+ Each [=/file system locator=] has an associated <dfn export for="file system locator" id=locator-path>path</dfn> (a [=/file system path=] ),
262
+ a <dfn export for="file system locator" id=locator-kind>kind</dfn> (a {{FileSystemHandleKind}} ), and
263
+ a <dfn export for="file system locator" id=locator-root>file system</dfn> (a [=/file system=] ).
264
+
265
+ Issue(109): Consider giving each locator a [=storage bucket=] .
266
+
267
+ A <dfn export>file locator</dfn> is a [=/file system locator=] whose
268
+ [=file system locator/kind=] is "{{FileSystemHandleKind/file}} ".
269
+ A <dfn export>directory locator</dfn> is a [=/file system locator=] whose
270
+ [=file system locator/kind=] is "{{FileSystemHandleKind/directory}} ".
271
+
272
+ <p class=example id=example-locator> For a [=/file system locator=] |locator|
273
+ whichs [=locate an entry|locates to=] a [=file entry=] |entry| that conceptually
274
+ exists at the path `data/drafts/example.txt` relative to the root directory of
275
+ a [=/bucket file system=] ,
276
+ |locator|'s [=file system locator/kind=] has to be "{{FileSystemHandleKind/file}} ",
277
+ |locator|'s [=file system locator/path=] has to be « "`data`", "`drafts`", "`example.txt`" », and
278
+ |locator|'s [=file system locator/file system=] has to be [=/bucket file system=] .
279
+
280
+ A [=/file system locator=] |a| is <dfn for="file system locator">the same locator as</dfn>
281
+ a [=/file system locator=] |b| if
282
+ |a|'s [=file system locator/kind=] is |b|' s [=file system locator/kind=] ,
283
+ |a|'s [=file system locator/file system=] is |b|' s [=file system locator/file system=] , and
284
+ |a|'s [=file system locator/path=] is [=the same path as=] |b|' s [=file system locator/path=] .
285
+
286
+ <p class=example id=example-path> Let |path| be the [=/list=]
287
+ « "`data`", "`drafts`", "`example.txt`" ».
288
+ There is no expectation that a file named `example.txt` exists anywhere on disk.
289
+
203
290
<div algorithm>
204
291
205
292
To <dfn for="file system locator" id=locator-resolve>resolve</dfn> a
206
293
[=/file system locator=] |child| relative to a [=directory locator=] |root|:
207
294
208
295
1. Let |result| be [=a new promise=] .
209
296
1. [=Enqueue the following steps=] to the [=file system queue=] :
210
- 1. If |child|'s [=FileSystemHandle/locator=]' s [=file system locator/root =]
211
- is not |root|'s [=FileSystemHandle/locator=]' s [=file system locator/root =] ,
297
+ 1. If |child|'s [=FileSystemHandle/locator=]' s [=file system locator/file system =]
298
+ is not |root|'s [=FileSystemHandle/locator=]' s [=file system locator/file system =] ,
212
299
[=/resolve=] |result| with null, and abort these steps.
213
300
214
301
1. Let |childPath| be |child|'s [=FileSystemHandle/locator=]' s [=file system locator/path=] .
@@ -234,85 +321,36 @@ To <dfn for="file system locator" id=locator-resolve>resolve</dfn> a
234
321
235
322
</div>
236
323
237
- A <dfn export>file system locator</dfn> represents a potential location of a
238
- [=/file system entry=] . A [=/file system locator=] is either a [=file locator=]
239
- or a [=directory locator=] .
240
-
241
- Each [=/file system locator=] has an associated <dfn export for="file system locator" id=locator-path>path</dfn> (a [=/file system path=] ),
242
- a <dfn export for="file system locator" id=locator-kind>kind</dfn> (a {{FileSystemHandleKind}} ), and
243
- a <dfn export for="file system locator" id=locator-root>root</dfn> (a [=file system root=] ).
244
-
245
- Issue(109): Consider giving each locator a [=storage bucket=] .
246
-
247
- A <dfn export>file locator</dfn> is a [=/file system locator=] whose
248
- [=file system locator/kind=] is "{{FileSystemHandleKind/file}} ".
249
- A <dfn export>directory locator</dfn> is a [=/file system locator=] whose
250
- [=file system locator/kind=] is "{{FileSystemHandleKind/directory}} ".
251
-
252
- A <dfn export>file system root</dfn> is an opaque [=string=] whose value is
253
- [=implementation-defined=] .
254
-
255
- <p class=example id=example-locator> For a [=/file system locator=] |locator|
256
- whichs [=locate an entry|locates to=] a [=file entry=] |entry| that conceptually
257
- exists at the path `data/drafts/example.txt` relative to the root directory of
258
- a [=/bucket file system=] ,
259
- |locator|'s [=file system locator/kind=] has to be "{{FileSystemHandleKind/file}} ",
260
- |locator|'s [=file system locator/path=] has to be « "`data`", "`drafts`", "`example.txt`" », and
261
- |locator|'s [=file system locator/root=] might include relevant identifying
262
- information such as the [=storage bucket=] and the disk drive.
263
-
264
- A [=/file system locator=] |a| is <dfn for="file system locator">the same locator as</dfn>
265
- a [=/file system locator=] |b| if
266
- |a|'s [=file system locator/kind=] is |b|' s [=file system locator/kind=] ,
267
- |a|'s [=file system locator/root=] is |b|' s [=file system locator/root=] , and
268
- |a|'s [=file system locator/path=] is [=the same path as=] |b|' s [=file system locator/path=] .
269
-
270
324
<div algorithm>
271
325
The <dfn export data-lt="locating an entry">locate an entry</dfn> algorithm given a
272
- [=/file system locator=] |locator| runs an [=implementation-defined=] series of steps adhering to
273
- these constraints:
326
+ [=/file system locator=] |locator| runs the following steps:
274
327
275
- - If |locator| is a [=file locator=] , they return a [=file entry=] or null.
276
- - If |locator| is a [=directory locator=] , they return a [=directory entry=] or null.
277
- - If these steps return a non-null |entry|, then:
278
- - [=Getting the locator=] with |entry| returns |locator|,
279
- provided no intermediate file system operations were run.
280
- - |entry|'s [=file system entry/name=] is the last [=list/item=] of |locator|' s
281
- [=file system locator/path=] .
328
+ 1. Let |file system| be |locator|'s [=file system locator/file system=] .
329
+ 1. Let |path| be |locator|'s [=file system locator/path=] .
330
+ 1. Let |entry| be the result of running |file system|'s
331
+ [=file system/locate an entry=] given |path|.
332
+ 1. If |entry| is null, return null.
333
+ 1. If |locator| is a [=file locator=] , [=Assert=] : |entry| is a [=file entry=] .
334
+ 1. If |locator| is a [=directory locator=] , [=Assert=] : |entry| is a [=directory entry=] .
335
+ 1. Return |entry|.
282
336
283
337
</div>
284
338
285
339
<div algorithm>
286
- The <dfn export data-lt="getting the locator">get the locator</dfn> algorithm given
287
- [=/file system entry=] |entry| runs an [=implementation-defined=] series of steps adhering to these
288
- constraints:
289
-
290
- - If |entry| is a [=file entry=] , they return a [= file locator=] .
291
- - If |entry| is a [=directory entry=] , they return a [=directory locator=] .
292
- - If these steps return | locator|, then:
293
- - [=Locating an entry =] with |locator| returns |entry|,
294
- provided no intermediate file system operations were run .
295
- - |entry|'s [=file system entry/name=] is the last [=list/item =] of |locator|' s
296
- [=file system locator/path=] .
340
+ The <dfn export data-lt="getting the locator">get the locator</dfn> algorithm given a
341
+ [=/file system entry=] |entry| runs the following steps:
342
+
343
+ 1. Let |file system| be |entry|'s [=file system entry/file system=] .
344
+ 1. Let |path| be the result of running | file system|'s
345
+ [=file system/get the path=] given |entry| .
346
+ 1. Let |locator| be a [=file system locator=] whose [=file system locator/path=]
347
+ is |path| and whose [=file system locator/file system =] is |file system|.
348
+ 1. If |entry| is a [=file entry=] , set |locator|'s [= file system locator/kind=] to "file" .
349
+ 1. If |entry| is a [=directory entry=] , set |locator|'s [=file system locator/kind =] to "directory".
350
+ 1. Return |entry| .
297
351
298
352
</div>
299
353
300
- A <dfn export>file system path</dfn> is a [=/list=] of one or more [=strings=] .
301
- This may be a virtual path that is mapped to real location on disk or in memory,
302
- may correspond directly to a path on the local file system, or may not
303
- correspond to any file on disk at all. The actual physical location of the
304
- corresponding [=/file system entry=] is [=implementation-defined=] .
305
-
306
- <p class=example id=example-path> Let |path| be the [=/list=]
307
- « "`data`", "`drafts`", "`example.txt`" ».
308
- There is no expectation that a file named `example.txt` exists anywhere on disk.
309
-
310
- A [=/file system path=] |a| is <dfn for="file system path">the same path as</dfn>
311
- a [=/file system path=] |b| if
312
- |a|'s [=list/size=] is the same as |b|' s [=list/size=] and
313
- [=list/for each=] |index| of |a|'s [=list/indices=]
314
- |a|.\[[|index|]] is |b|.\[[|index|]] .
315
-
316
354
<p class=warning> The contents of a [=/file system locator=] , including its
317
355
[=file system locator/path=] , are not expected to be shared in their entirety
318
356
with the website process. The [=/file system path=] might contain components
@@ -443,12 +481,12 @@ given a [=directory locator=] |parentLocator| and a string |name| in a [=/Realm=
443
481
444
482
1. Let |handle| be a [=new=] {{FileSystemFileHandle}} in |realm|.
445
483
1. Let |childType| be "{{FileSystemHandleKind/file}} ".
446
- 1. Let |childRoot | be a copy of |parentLocator|'s [=file system locator/root=] .
484
+ 1. Let |childFileSystem | be the |parentLocator|'s [=file system locator/file system=]
447
485
1. Let |childPath| be the result of [=list/clone|cloning=] |parentLocator|'s
448
486
[=file system locator/path=] and [=list/append|appending=] |name|.
449
487
1. Set |handle|'s [=FileSystemHandle/locator=] to a [=/file system locator=] whose
450
488
[=file system locator/kind=] is |childType|,
451
- [=file system locator/root =] is |childRoot |, and
489
+ [=file system locator/file system =] is |childFileSystem |, and
452
490
[=file system locator/path=] is |childPath|.
453
491
1. Return |handle|.
454
492
@@ -457,13 +495,13 @@ given a [=directory locator=] |parentLocator| and a string |name| in a [=/Realm=
457
495
<div algorithm>
458
496
To
459
497
<dfn export data-lt="creating a new FileSystemFileHandle">create a new `FileSystemFileHandle`</dfn>
460
- given a [=/file system root =] |root | and a [=/file system path=] |path|
498
+ given a [=/file system=] |file system | and a [=/file system path=] |path|
461
499
in a [=/Realm=] |realm|:
462
500
463
501
1. Let |handle| be a [=new=] {{FileSystemFileHandle}} in |realm|.
464
502
1. Set |handle|'s [=FileSystemHandle/locator=] to a [=/file system locator=] whose
465
503
[=file system locator/kind=] is "{{FileSystemHandleKind/file}} ",
466
- [=file system locator/root =] is |root |, and
504
+ [=file system locator/file system =] is |file system |, and
467
505
[=file system locator/path=] is |path|.
468
506
1. Return |handle|.
469
507
@@ -698,12 +736,12 @@ given a [=directory locator=] |parentLocator| and a string |name| in a [=/Realm=
698
736
699
737
1. Let |handle| be a [=new=] {{FileSystemDirectoryHandle}} in |realm|.
700
738
1. Let |childType| be "{{FileSystemHandleKind/directory}} ".
701
- 1. Let |childRoot | be a copy of |parentLocator|'s [=file system locator/root =] .
739
+ 1. Let |childFileSystem | be the |parentLocator|'s [=file system locator/file system =] .
702
740
1. Let |childPath| be the result of [=list/clone|cloning=] |parentLocator|'s
703
741
[=file system locator/path=] and [=list/append|appending=] |name|.
704
742
1. Set |handle|'s [=FileSystemHandle/locator=] to a [=/file system locator=] whose
705
743
[=file system locator/kind=] is |childType|,
706
- [=file system locator/root =] is |childRoot |, and
744
+ [=file system locator/file system =] is |childFileSystem |, and
707
745
[=file system locator/path=] is |childPath|.
708
746
1. Return |handle|.
709
747
@@ -712,13 +750,13 @@ given a [=directory locator=] |parentLocator| and a string |name| in a [=/Realm=
712
750
<div algorithm>
713
751
To
714
752
<dfn export data-lt="creating a new FileSystemDirectoryHandle">create a new `FileSystemDirectoryHandle`</dfn>
715
- given a [=/file system root =] |root | and a [=/file system path=] |path|
753
+ given a [=/file system=] |file system | and a [=/file system path=] |path|
716
754
in a [=/Realm=] |realm|:
717
755
718
756
1. Let |handle| be a [=new=] {{FileSystemDirectoryHandle}} in |realm|.
719
757
1. Set |handle|'s [=FileSystemHandle/locator=] to a [=/file system locator=] whose
720
758
[=file system locator/kind=] is "{{FileSystemHandleKind/directory}} ",
721
- [=file system locator/root =] is |root |, and
759
+ [=file system locator/file system =] is |file system |, and
722
760
[=file system locator/path=] is |path|.
723
761
1. Return |handle|.
724
762
@@ -1675,12 +1713,17 @@ guarantee.
1675
1713
1676
1714
# Accessing the Bucket File System # {#sandboxed-filesystem}
1677
1715
1678
- The <dfn export id=origin-private-file-system>bucket file system</dfn> is a
1679
- [=storage endpoint=] whose
1680
- <a spec=storage for="storage endpoint">identifier</a> is `"fileSystem"`,
1716
+ The <dfn export id=origin-private-file-system>bucket file system</dfn>
1717
+ is a [=/file system=] implementation
1718
+ whose [=file system/root=] is an [=implementation-defined=] opaque [=string=]
1719
+ and whose [=storage endpoint=] 's
1720
+ <a spec=storage for="storage endpoint">identifier</a> of `"fileSystem"`,
1681
1721
<a spec=storage for="storage endpoint">types</a> are `« "local" »`,
1682
1722
and <a spec=storage for="storage endpoint">quota</a> is null.
1683
1723
1724
+ Note: [=/bucket file system=] 's [=file system/root=] might include relevant
1725
+ identifying information such as the [=storage bucket=] .
1726
+
1684
1727
Issue: Storage endpoints should be defined in [[storage]] itself, rather
1685
1728
than being defined here. So merge this into the table there.
1686
1729
@@ -1721,13 +1764,10 @@ The <dfn method for=StorageManager>getDirectory()</dfn> method steps are:
1721
1764
1. Set |dir|'s [=directory entry/children=] to an empty [=/set=] .
1722
1765
1. Set |map|["root"] to |dir|.
1723
1766
1724
- 1. Let |root | be an [=implementation-defined=] opaque [=string =] .
1767
+ 1. Let |file system | be [=/bucket file system=] 's [=/ile system/root =] .
1725
1768
1. Let |path| be « the empty string ».
1726
1769
1. Let |handle| be the result of <a>creating a new `FileSystemDirectoryHandle`</a> .
1727
- given |root| and |path| in the [=current realm=] .
1728
-
1729
- Note: |root| might include relevant identifying information such as the
1730
- [=storage bucket=] .
1770
+ given |file system| and |path| in the [=current realm=] .
1731
1771
1732
1772
1. Assert: [=locating an entry=] given |handle|'s [=FileSystemHandle/locator=]
1733
1773
returns a [=directory entry=] that is [=the same entry as=] |map|["root"] .
0 commit comments