Documentation
¶
Overview ¶
Package containerlock provides a system-wide file lock that serializes the "count running containers → start container" sequence across multiple dark-factory daemon instances.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerLock ¶
type ContainerLock interface {
// Acquire blocks until the lock is obtained or ctx is cancelled.
Acquire(ctx context.Context) error
// Release releases the lock.
Release(ctx context.Context) error
}
ContainerLock serializes the check-and-start sequence across daemon instances so that the maxContainers limit is never exceeded.
func NewContainerLock ¶
func NewContainerLock(ctx context.Context) (ContainerLock, error)
NewContainerLock creates a ContainerLock backed by a file at $HOME/.dark-factory/container.lock.
func NewContainerLockFromPath ¶
func NewContainerLockFromPath(lockPath string) ContainerLock
NewContainerLockFromPath creates a ContainerLock backed by the given lock file path. The parent directory must already exist. This is intended for testing.
Click to show internal directories.
Click to hide internal directories.