containerlock

package
v0.199.12 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: BSD-2-Clause Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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