Skip to content

Add new locking modes to file handle primitives#151

Open
nathanmemmott wants to merge 4 commits into
whatwg:mainfrom
nathanmemmott:new_sah_and_wfs_lock_modes
Open

Add new locking modes to file handle primitives#151
nathanmemmott wants to merge 4 commits into
whatwg:mainfrom
nathanmemmott:new_sah_and_wfs_lock_modes

Conversation

@nathanmemmott

@nathanmemmott nathanmemmott commented Nov 14, 2023

Copy link
Copy Markdown
Contributor

Add new locking modes to file handle primitives

Writable file streams and sync access handles can now be created with an optional "mode" parameter.

For sync access handles, "mode" can be "readwrite", "readonly", or "readwrite-unsafe". "readwrite" is the current behavior and the default if "mode" is not specified. Only one sync access handle can be open on a file handle in this mode. The two new modes, "readonly" and "readwrite-unsafe", are shared modes which are added to support multiple readers and writers.

For writable file streams, "mode" can be "exclusive" or "siloed". "siloed" is the current behavior and the default if "mode" is not specified. This mode allows multiple writers to clobber each other. The new "exclusive" mode is added to prevent this clobbering.

For a more detailed explanation, see Multiple Readers and Writers explainer: https://github.com/whatwg/fs/blob/main/proposals/MultipleReadersWriters.md.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@a-sully a-sully left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lots of nits, but the overall shape of this change LGTM

Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
@nathanmemmott nathanmemmott force-pushed the new_sah_and_wfs_lock_modes branch 2 times, most recently from dc89f60 to 3f084f0 Compare November 18, 2023 00:09
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
@nathanmemmott nathanmemmott force-pushed the new_sah_and_wfs_lock_modes branch from 3f084f0 to 9475e66 Compare November 21, 2023 00:11

@a-sully a-sully left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM but it would be nice to get eyes on this from another implementer before merging

Comment thread index.bs Outdated
Comment thread index.bs Outdated
@nathanmemmott nathanmemmott force-pushed the new_sah_and_wfs_lock_modes branch from 9475e66 to e9ba03b Compare November 21, 2023 23:28
@nathanmemmott

Copy link
Copy Markdown
Contributor Author

cc @jesup @szewai @annevk
Can you take a look at this?

Nathan Memmott added 4 commits December 19, 2023 15:17
Adds new locking modes for sync access handles and writable file
streams. Updates "file entry/take a lock" and "file entry/lock/release"
to support these new modes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants