lockfile

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlockExclusiveBlocking

func FlockExclusiveBlocking(f *os.File) error

FlockExclusiveBlocking acquires an exclusive blocking lock on the file. This will wait until the lock is available.

func FlockUnlock

func FlockUnlock(f *os.File) error

FlockUnlock releases a lock on the file.

func TryDaemonLock

func TryDaemonLock(beadsDir string) (running bool, pid int)

TryDaemonLock attempts to acquire and immediately release the daemon lock to check if a daemon is running. Returns true if daemon is running. Falls back to PID file check for backward compatibility with pre-lock daemons.

This is a cheap probe operation that should be called before attempting RPC connections to avoid unnecessary connection timeouts.

Types

type LockInfo

type LockInfo struct {
	PID       int       `json:"pid"`
	ParentPID int       `json:"parent_pid,omitempty"`
	Database  string    `json:"database"`
	Version   string    `json:"version"`
	StartedAt time.Time `json:"started_at"`
}

LockInfo represents the metadata stored in the daemon.lock file

func ReadLockInfo

func ReadLockInfo(beadsDir string) (*LockInfo, error)

ReadLockInfo reads and parses the daemon lock file Returns lock info if available, or error if file doesn't exist or can't be parsed

Jump to

Keyboard shortcuts

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