flock

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLock

func WithLock(options Options, syncFn func() error) error

WithLock executes a callback function with a global exclusive file-system lock If the lock is never acquired, the returned error will be of type flock.Error Else, the error will be whatever was returned by the callback function

Types

type Error

type Error struct {
	Err error // Err underlying error (if there was one)
	// contains filtered or unexported fields
}

Error for errors generated in the flock package

func (*Error) Error

func (err *Error) Error() string

Error() implements error interface

type Options

type Options struct {
	Path          string        // Path to file to use for lock
	RetryInterval time.Duration // RetryInterval how often to retry lock attempts
	Timeout       time.Duration // Timeout how long to wait for the lock before giving up
}

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