Skip to content

Commit e860d82

Browse files
a-sullyannevk
andauthored
Describe flushing and don't flush on close()
Fixes #71. Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
1 parent 048a672 commit e860d82

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

index.bs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ The <dfn method for=FileSystemFileHandle>createWritable(|options|)</dfn> method
370370
: |handle| = await |fileHandle| . {{FileSystemFileHandle/createSyncAccessHandle()|createSyncAccessHandle}}()
371371
:: Returns a {{FileSystemSyncAccessHandle}} that can be used to read from/write to the file.
372372
Changes made through |handle| might be immediately reflected in the file represented by |fileHandle|.
373-
To ensure the changes are reflected in this file, the handle can be flushed or closed.
373+
To ensure the changes are reflected in this file, the handle can be flushed.
374374

375375
Creating a {{FileSystemSyncAccessHandle}} [=file entry/lock/take|takes an exclusive lock=] on the
376376
[=FileSystemHandle/entry=] associated with |fileHandle|. This prevents the creation of
@@ -677,7 +677,6 @@ The <dfn method for=FileSystemDirectoryHandle>removeEntry(|name|, |options|)</df
677677
1. [=/Reject=] |result| with a {{NotFoundError}}.
678678
1. Return |result|.
679679

680-
681680
</div>
682681

683682
### The {{FileSystemDirectoryHandle/resolve()}} method ### {#api-filesystemdirectoryhandle-resolve}
@@ -1198,7 +1197,6 @@ The <dfn method for=FileSystemSyncAccessHandle>getSize()</dfn> method steps are:
11981197
1. If [=this=].[=[[state]]=] is "`closed`", throw an {{InvalidStateError}}.
11991198
1. Return [=this=].[=FileSystemSyncAccessHandle/[[file]]=]'s [=file entry/binary data=]'s [=byte sequence/length=].
12001199

1201-
12021200
</div>
12031201

12041202
### The {{FileSystemSyncAccessHandle/flush()}} method ### {#api-filesystemsyncaccesshandle-flush}
@@ -1211,23 +1209,34 @@ The <dfn method for=FileSystemSyncAccessHandle>getSize()</dfn> method steps are:
12111209
<div algorithm>
12121210
The <dfn method for=FileSystemSyncAccessHandle>flush()</dfn> method steps are:
12131211

1214-
Issue(71): Fill in, after figuring out language to describe flushing at the OS level.
1212+
1. If [=this=].[=[[state]]=] is "`closed`", [=throw=] an "{{InvalidStateError}}"
1213+
{{DOMException}}.
1214+
1. Attempt to transfer all cached modifications of the file's content to the
1215+
file system's underlying storage device.
1216+
1217+
Note: This is also known as flushing. This may be a no-op on some file
1218+
systems, such as in-memory file systems, which do not have a "disk" to flush
1219+
to.
12151220

12161221
</div>
12171222

12181223
### The {{FileSystemSyncAccessHandle/close()}} method ### {#api-filesystemsyncaccesshandle-close}
12191224

12201225
<div class="note domintro">
12211226
: |handle| . {{FileSystemSyncAccessHandle/close()}}
1222-
:: Flushes the access handle and then closes it. Closing an access handle disables any further operations on it and
1223-
[=file entry/lock/release|releases the lock=] on the [=FileSystemHandle/entry=] associated with |handle|.
1227+
:: Closes the access handle. This disables any further operations on it and
1228+
[=file entry/lock/release|releases the lock=] on the
1229+
[=FileSystemHandle/entry=] associated with |handle|.
12241230
</div>
12251231

12261232
<div algorithm>
12271233
The <dfn method for=FileSystemSyncAccessHandle>close()</dfn> method steps are
12281234
to set [=this=].[=[[state]]=] to "`closed`".
12291235

1230-
Issue(71): Figure out language to describe flushing the file at the OS level before closing the handle.
1236+
Note: This method does not guarantee that all file modifications will be
1237+
immediately reflected in the underlying storage device. Call the
1238+
{{FileSystemSyncAccessHandle/flush()}} method first if you require this
1239+
guarantee.
12311240

12321241
</div>
12331242

0 commit comments

Comments
 (0)