You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current state of the fs module, operations are not ensured to happen in an order-respecting-sequential manner.
As it appears other JS runtimes, such as Deno, do seem to ensure this ordering of operations (although we couldn't find official information about such guarantees), we would like to provide the same guarantee to users of the fs module.
Specifically, we would like to ensure the following behavior:
lets1=file.operation(...)lets2=file.operation(...)// the underlying operation will be executed after the `s1` underlying operation lets3=file.operation(...)// the underlying operation will be executed after the `s2` underlying operationconstresult=awaits3;// we wait for the underlying operation execution to be done, and return its result
Define an internal representation of a filesystem command and use channels to ensure the execution ordering internally.
Have the file struct keep a pointer to its latest operation, and when a new operation is issued, have it ensure that it awaits the resolution of the previous one implicitly before moving on and updating the pointer with itself.
Both of these solutions are untested and would need further exploration and research.
Already existing or connected issues / PRs (optional)
Feature Description
In the current state of the
fs
module, operations are not ensured to happen in an order-respecting-sequential manner.As it appears other JS runtimes, such as Deno, do seem to ensure this ordering of operations (although we couldn't find official information about such guarantees), we would like to provide the same guarantee to users of the
fs
module.Specifically, we would like to ensure the following behavior:
Suggested Solution (optional)
Two potential approaches have been proposed in this PR's discussion, namely:
file
struct keep a pointer to its latest operation, and when a new operation is issued, have it ensure that it awaits the resolution of the previous one implicitly before moving on and updating the pointer with itself.Both of these solutions are untested and would need further exploration and research.
Already existing or connected issues / PRs (optional)
#3420
#3354
The text was updated successfully, but these errors were encountered: