-
Notifications
You must be signed in to change notification settings - Fork 4
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
Unify File Locking Across Domains #251
Comments
Instead of C++, one can also use Rust: https://github.com/napi-rs/napi-rs Can be useful if you want to gain experience in this new language. |
Locking at https://github.com/mafintosh/fd-lock/blob/master/binding.cc C++ code I see it using On win32 however, it should be swapped to using this call instead: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-lockfileex Also important would be to apply promise-based API, so one can wait or block on the locks as well. Promise based system would require the C++ to notify the events. It appears the Node API can be called from C++ to create a promise: https://github.com/nodejs/node-addon-api/blob/main/doc/promises.md |
Testing should make use of a Windows CI/CD environment, just do manual test for now as it seems integrating Windows in our current CI/CD setup might be a bit difficult. |
No longer necessary because both The And This means In the future we can improve lock performance and lock portability by following the above instructions/notes, but for now it's a wontfix. @tegefaulkes @emmacasolin @joshuakarp Note that this only applies to "file locking". Which is only used by |
Specification
Previously we were using the proper-lockfile library to lock and unlock the session file during CLI calls, however, we have recently switched over to using the much simpler (and newer) fd-lock for this purpose. However,
proper-lockfile
is still being used for the agent lockfile, so we should change this to usefd-lock
instead in order to unify our file locking across all domains.Since
fd-lock
currently only has alock()
andunlock()
command (and no way of checking if a file is locked without attempting to lock it or blocking access to a locked file) we will most likely need to look into the Node C++ bindings and the POSIX manual in order to adapt the library to our needs.Additional context
See #236, where
fd-lock
was incorporated into the sessions domain.Tasks
fd-lock
library to meet our requirementsproper-lockfile
usage withfd-lock
in the agent lockfileThe text was updated successfully, but these errors were encountered: