lockfile

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyLocked indicates the lock is held by another process.
	ErrAlreadyLocked = errors.New("lock already held")
)

Functions

func ReadContent

func ReadContent(path string) ([]byte, error)

func RetireIf added in v0.7.2

func RetireIf(path string, shouldRetire func([]byte) (bool, error)) (bool, error)

RetireIf takes the existing lock without changing its content, evaluates the active lease while holding the lock, and clears it only when the callback confirms that the lease is safe to retire.

Types

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

func Acquire

func Acquire(path string) (*Lock, error)

func (*Lock) Path

func (l *Lock) Path() string

func (*Lock) Release

func (l *Lock) Release() error

func (*Lock) SetContent

func (l *Lock) SetContent(body []byte) error

Jump to

Keyboard shortcuts

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