flock

package
v1.1.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker added in v0.0.41

type Locker interface {
	// Path return the path of the file used by this Locker instance
	Path() string
	// WithLock wait for the lock and then execute the given function
	WithLock(cb func() error) error
}

func NewLocker added in v0.0.41

func NewLocker(lockFile string, options ...Option) Locker

type Option added in v0.0.41

type Option func(*Options)

type Options

type Options struct {
	RetryInterval time.Duration // RetryInterval how often to retry lock attempts (default 100ms)
	Timeout       time.Duration // Timeout how long to wait for the lock before giving up (default 5s)
}

Options holds necessary attributes for a file lock with a timeout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL