@php-wasm/node
Index
Classes
Functions
Interfaces
Type Aliases
Type Aliases
Fd
FileLockManager
Type declaration
findFirstConflictingByteRangeLock: (path: string, desiredLock: RequestedRangeLock) => Omit<RequestedRangeLock, fd> | undefined
Get the first lock that would conflict with the specified lock.
This method is meant to satisfy the needs of the F_GETLK fcntl() command. https://sourceware.org/glibc/manual/2.41/html_node/File-Locks.html#index-F_005fGETLK-1
Parameters
path: string
The path of the file to check for conflicts. This should be the path of the file in the underlying filesystem.
desiredLock: RequestedRangeLock
The lock to check for conflicts.
Returns Omit<RequestedRangeLock, fd> | undefined
lockFileByteRange: (path: string, requestedLock: RequestedRangeLock) => boolean
Update the lock on a byte range of a file.
This method is for locking with the F_SETLK fcntl() command. https://sourceware.org/glibc/manual/2.41/html_node/File-Locks.html#index-F_005fSETLK-1
Parameters
path: string
The path of the file to lock. This should be the path of the file in the underlying filesystem.
requestedLock: RequestedRangeLock
The lock to request, including start, end, type, and pid.
Returns boolean
lockWholeFile: (path: string, op: WholeFileLockOp) => boolean
Update the lock on the whole file.
This method is for updating the lock on the whole file with the F_SETLKW fcntl() command. https://sourceware.org/glibc/manual/2.41/html_node/File-Locks.html#index-F_005fSETLKW-1
Parameters
path: string
The path of the file to lock. This should be the path of the file in the underlying filesystem.
op: WholeFileLockOp
The operation to perform, including 'shared', 'exclusive', or 'unlock'.
Returns boolean
releaseLocksForProcess: (pid: number) => void
Release all locks for a given process.
Used when a process exits or is otherwise terminated.
Parameters
pid: number
The PID of the process that wants to release the locks.
Returns void
releaseLocksForProcessFd: (pid: number, fd: number, path: string) => void
Release all locks for the given process and file descriptor.
Parameters
pid: number
The process ID to release locks for.
fd: number
The file descriptor to release locks for.
path: string
The path to the file to release locks for. This should be the path of the file in the underlying filesystem.
Returns void
Pid
RequestedRangeLock
WholeFileLock
WholeFileLockOp
Type declaration
fd: number
pid: number
type: shared | exclusive | unlock
WholeFileLock_Exclusive
WholeFileLock_Shared
WholeFileLock_Unlocked
Type declaration
type: unlocked
This is an interface used to abstract byte range locking like fcntl() and whole-file locking like flock().