filelock

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLock

type FileLock struct {
	Path     string
	OwnerID  string
	LockedAt time.Time
}

FileLock represents a lock on a file

type LockManager

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

LockManager manages file locks across multiple agents

func Global

func Global() *LockManager

Global returns the singleton lock manager

func NewLockManager

func NewLockManager() *LockManager

NewLockManager creates a new lock manager

func (*LockManager) Acquire

func (m *LockManager) Acquire(path, ownerID string, timeout time.Duration) error

Acquire attempts to acquire a lock on a file Blocks until lock is available or timeout is reached

func (*LockManager) ForceRelease

func (m *LockManager) ForceRelease(path string) error

ForceRelease forcibly releases a lock on a file Used for cleanup when an agent crashes

func (*LockManager) IsLocked

func (m *LockManager) IsLocked(path string) bool

IsLocked checks if a file is currently locked

func (*LockManager) Release

func (m *LockManager) Release(path, ownerID string) error

Release releases a lock on a file Returns error if lock is not held by the specified owner

func (*LockManager) ReleaseAll

func (m *LockManager) ReleaseAll(ownerID string) error

ReleaseAll releases all locks held by a specific owner Used when an agent shuts down

Jump to

Keyboard shortcuts

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