Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new locking modes to file handle primitives #151

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nathanmemmott
Copy link
Contributor

@nathanmemmott nathanmemmott commented Nov 14, 2023

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

Copy link
Collaborator

@a-sully a-sully left a comment

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

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@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
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
Copy link
Collaborator

@a-sully a-sully left a comment

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

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@nathanmemmott
Copy link
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