Documentation ¶
Index ¶
- Variables
- func Init() error
- func Lock(name string, opts LockOptions) error
- func TryLock(name string, opts TryLockOptions) (bool, error)
- func Unlock(name string) error
- func WithLock(name string, opts LockOptions, f func() error) error
- type Base
- type File
- type LockObject
- type LockOptions
- type TryLockOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LocksDir string Locks map[string]LockObject DefaultTimeout = 24 * time.Hour )
Functions ¶
func Lock ¶
func Lock(name string, opts LockOptions) error
Types ¶
type LockObject ¶
type LockObject interface { GetName() string Lock(timeout time.Duration, readOnly bool, onWait func(doWait func() error) error) error Unlock() error WithLock(timeout time.Duration, readOnly bool, onWait func(doWait func() error) error, f func() error) error }
func NewFileLock ¶
func NewFileLock(name string, locksDir string) LockObject
type LockOptions ¶
type TryLockOptions ¶
type TryLockOptions struct {
ReadOnly bool
}
Click to show internal directories.
Click to hide internal directories.