Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LockRelease ¶
Types ¶
type AlreadyLockedError ¶
type AlreadyLockedError struct {
// contains filtered or unexported fields
}
AlreadyLockedError manages info that clarifies why a lock has failed, but is still likely valid.
func NewAlreadyLockedError ¶
func NewAlreadyLockedError(err error, file, msg string) *AlreadyLockedError
NewAlreadyLockedError returns a new AlreadyLockedError.
func (*AlreadyLockedError) Error ¶
func (e *AlreadyLockedError) Error() string
Error implements the error interface.
func (*AlreadyLockedError) Stack ¶
func (e *AlreadyLockedError) Stack() *stacktrace.Stacktrace
Stack implements the errs.WrapperError interface.
func (*AlreadyLockedError) Unwrap ¶
func (e *AlreadyLockedError) Unwrap() error
Unwrap allows the unwrapping of a causing error.
type PidLock ¶
type PidLock struct {
// contains filtered or unexported fields
}
PidLock represents a lock file that can be used for exclusive access to resources that should be accessed by only one process at a time.
The characteristics of the lock are: - Lockfiles are removed after use - Even if the lockfiles are not removed (because a process has been terminated prematurely), it is unlocked - On file-systems that support advisory locks via fcntl or LockFileEx, all file system operations are atomic
Notes: - The implementation currently does not support a blocking wait operation that returns once the lock can be acquired. If required, it can be extended this way. - Storing the PID inside the lockfile was initially intended to be fall-back mechanism for file systems that do not support locking files. This is probably unnecessary, but could be extended to communicate with the process currently holding the lock via its PID.
func NewPidLock ¶
NewPidLock creates a new PidLock that can be used to get exclusive access to resources between processes