Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPathEmpty indicates that no path was specified ErrPathEmpty = errors.New("lock path is empty") // ErrAcquireLockFailed indicates that it was not possible to lock the resource. ErrAcquireLockFailed = errors.New("unable to acquire a lock on the file") )
Functions ¶
func AcquireReadLock ¶
AcquireReadLock tries to acquire a shared lock to read from the file and returns a lock object or an error accordingly. Call with the file to lock. This function creates .lock file next to it.
func AcquireWriteLock ¶
AcquireWriteLock tries to acquire a shared lock to write from the file and returns a lock object or an error accordingly. Call with the file to lock. This function creates an extra .lock file next to it.
func ReleaseLock ¶
ReleaseLock releases a lock from a file that was previously created by AcquireReadLock or AcquireWriteLock.
func SetMaxLockCycles ¶ added in v2.11.0
func SetMaxLockCycles(v int)
SetMaxLockCycles configures the maximum amount of lock cycles. Subsequent calls to SetMaxLockCycles have no effect
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.