lockfile

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package lockfile serializes work between devbay processes.

devbay is a short-lived CLI, and the interesting operations are the ones several copies of it perform at once: two terminals, or an agent calling `devbay new` three times in parallel, which is the thing devbay is for. A mutex only orders the goroutines inside one process, so anything that reads shared state, modifies it, and writes it back needs a lock the operating system enforces across processes.

Index

Constants

View Source
const Timeout = 2 * time.Minute

Timeout bounds the wait. The operations this guards are sub-second, so a wait this long means a process died holding the lock rather than that someone is genuinely ahead in the queue. Failing with an explanation beats hanging without one.

Variables

This section is empty.

Functions

func Acquire

func Acquire(key string) (func(), error)

Acquire takes the named lock and returns the release.

Not reentrant: flock associates the lock with the open file description, so a second acquisition in the same process waits for the first, and a caller holding it would wait for itself.

func Path

func Path(key string) (string, error)

Path names the lock file for a key.

Hashed because a key may be an absolute path: it can contain separators, it can be longer than a filename may be, and two keys with the same basename must not collide.

Types

This section is empty.

Jump to

Keyboard shortcuts

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