Intent to Ship: Multiple Readers and Writers in File System Access API

305 views
Skip to first unread message

Nathan Memmott

unread,
Nov 27, 2023, 7:19:42 PM11/27/23
to blin...@chromium.org

Contact emails

ds...@google.com, mem...@google.com


Explainer

https://github.com/whatwg/fs/blob/main/proposals/MultipleReadersWriters.md


Specification

https://github.com/whatwg/fs/pull/151


Summary

Currently, only one FileSystemSyncAccessHandle may be open at a time per file, preventing an origin from reading and writing to the same file from multiple tabs easily. Conversely, multiple FileSystemWritableFileStreams can be simultaneously open, letting multiple writers clobber each other.


Introducing new locking modes for FileSystemSyncAccessHandle and FileSystemWritableFileStream allows opening either multiple readers/writers or an exclusive writer to a file entry, depending on the application's use case.


```

handle.createSyncAccessHandle({ mode: 'read-only' });

handle.createSyncAccessHandle({ mode: 'readwrite-unsafe' });


handle.createWritable({ mode: 'exclusive' });

```



Blink component

Blink>Storage>FileSystem


TAG review

https://github.com/w3ctag/design-reviews/issues/845


TAG review status

Issues addressed


Origin Trial documentation link

https://developer.chrome.com/blog/new-dev-trial-for-multiple-readers-and-writers/


Risks



Interoperability and Compatibility



Gecko: Positive (https://github.com/mozilla/standards-positions/issues/861)


WebKit: No Signal (https://github.com/WebKit/standards-positions/issues/238)


Web developers: Positive (https://github.com/whatwg/fs/issues/34)


Other signals: Emscripten plans to utilize multiple readers and writers for performance improvement, and sites using Emscripten will be able to take advantage of this integration.


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

Feature is web exposed through WebIDL changes. No additional implementation effort is required.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes


Is this feature fully tested by web-platform-tests?

WPTs have been added that fully test the behavior of the new locking modes. They additionally test the interactions between combinations of primitives, their different modes, and file handle operations.

https://wpt.fyi/results/fs/FileSystemFileHandle-cross-primitive-locking.https.tentative.worker.html?label=experimental&label=master&aligned

https://wpt.fyi/results/fs/FileSystemFileHandle-sync-access-handle-lock-modes.https.tentative.worker.html?label=experimental&label=master&aligned

https://wpt.fyi/results/fs/FileSystemFileHandle-writable-file-stream-lock-modes.https.tentative.worker.html?label=experimental&label=master&aligned



Flag name on chrome://flags

file-system-access-locking-scheme


Finch feature name

FileSystemAccessLockingScheme


Requires code in //chrome?

False


Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1382215


Launch bug

https://launch.corp.google.com/launch/4261043


Estimated milestones

Shipping on desktop

121






Anticipated spec changes

Discussion: https://github.com/whatwg/fs/issues/34

No open issues that introduce web compat/interop risk.



Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5172892632875008


Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAPscNz5Oi-z6-%2BvTVyf9BNgvVnLZeQo5nfzyRhEZ_F400tTP3w%40mail.gmail.com


Yoav Weiss

unread,
Nov 29, 2023, 4:18:04 PM11/29/23
to blink-dev, mem...@google.com
Can you please tick all the review boxes in the Chrome status entry?

Ajay Rahatekar

unread,
Nov 29, 2023, 7:17:21 PM11/29/23
to blink-dev, yoav...@chromium.org, Nathan Memmott

Mike Taylor

unread,
Nov 30, 2023, 7:06:15 PM11/30/23
to Ajay Rahatekar, blink-dev, yoav...@chromium.org, Nathan Memmott

Seems like a useful addition to the API. LGTM1

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/bd470b7d-4fa3-4874-a421-a2376910bc9bn%40chromium.org.

Rick Byers

unread,
Dec 5, 2023, 7:14:25 PM12/5/23
to Nathan Memmott, blin...@chromium.org
LGTM2.

Looks like the spec PR is reviewed but just blocked waiting for input from a 2nd implementor, but Firefox has implemented their support. Can you poke the relevant Firefox folks to see if someone can chime in on the spec PR to help get it landed? But doesn't seem necessary to block this I2S on that to me.



--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Yoav Weiss

unread,
Dec 6, 2023, 4:01:30 PM12/6/23
to blink-dev, Rick Byers, blin...@chromium.org, mem...@google.com
LGTM3

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
Reply all
Reply to author
Forward
0 new messages