containerlock

package
v0.137.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: BSD-2-Clause Imports: 6 Imported by: 0

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.

Jump to

Keyboard shortcuts

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