operationlock

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package operationlock coordinates CLI operations across processes.

Index

Constants

This section is empty.

Variables

View Source
var ErrBusy = errors.New("lock held")

ErrBusy reports that another process holds a conflicting lock.

Functions

func Acquire

func Acquire(appData, target, operation string) (func(), error)

Acquire locks a target, or all targets when target is empty. operation names the command for the holder description. Lock files remain in place so another process cannot lock a replacement inode during release.

func AcquireShared

func AcquireShared(appData, target, operation string) (func(), error)

AcquireShared holds an image read lock while independent instances clone it.

func AcquireSharedWithin

func AcquireSharedWithin(appData, target, operation string, timeout time.Duration) (func(), error)

AcquireSharedWithin waits for an image read lock, honoring the CLI timeout.

func AcquireWithin

func AcquireWithin(appData, target, operation string, timeout time.Duration) (func(), error)

AcquireWithin is Acquire, retrying with backoff while the lock is busy for up to timeout. A zero timeout tries exactly once. When it gives up, the error names the processes holding the conflicting locks where they are known.

Types

type Holder

type Holder struct {
	PID       int       `json:"pid"`
	Program   string    `json:"program"`
	Operation string    `json:"operation,omitempty"`
	Target    string    `json:"target,omitempty"`
	Since     time.Time `json:"since"`
}

Holder describes the process holding an exclusive lock. It is written into the lock file so a refused process can say who is busy. Locks cover a byte range far beyond the content (see lockFile), so the content stays readable on Windows too.

func (Holder) String

func (h Holder) String() string

Jump to

Keyboard shortcuts

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