record-level locking...
It would be nice if you can do a record level lock for read/write...
fs.flock(fd, 'sh', function(err){
fs.flockRead(bytesToRead, function(err, buffer){
//buffer should be the bytes read after an exclusive lock of that record
// offset at the current position, for the length of the bytes requested to read.
});
fs.flockWrite(buffer, function(err){})
});
flock doesn't support record level locking: https://linux.die.net/man/2/flock
I think it's only possible on Windows (not sure if there's mechanisms to do this on Unix-like OS's). It seems like a terribly fragile piece of technology to use, and must be NTFS only.
On Wed, Feb 6, 2019 at 12:59 PM Sam Roberts [email protected] wrote:
flock doesn't support record level locking: https://linux.die.net/man/2/flock
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baudehlo/node-fs-ext/issues/35#issuecomment-461122578, or mute the thread https://github.com/notifications/unsubscribe-auth/AAobYyWdOmics4V9synZmWeOce1gTxToks5vKxflgaJpZM4CxEIX .
Unixen have byte-range locking:
- http://man7.org/linux/man-pages/man3/lockf.3.html
- Advisory record locking in http://man7.org/linux/man-pages/man2/fcntl.2.html