lock

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package lock provides an advisory-locked file per environment so that two c2quay processes cannot deploy to the same environment simultaneously.

v0 uses flock(2) and is therefore local to the host. Distributed coordination (redis, consul) is a future extension.

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyHeld = errors.New("lock is already held")

ErrAlreadyHeld is returned by Acquire when another process holds the lock.

Functions

This section is empty.

Types

type FileLock

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

FileLock holds an exclusive flock(2) for its lifetime.

func Acquire

func Acquire(path string) (*FileLock, error)

Acquire takes an exclusive non-blocking flock on path. It returns ErrAlreadyHeld if another process currently holds the lock.

func (*FileLock) Path

func (l *FileLock) Path() string

Path returns the on-disk location of the lock file.

func (*FileLock) Release

func (l *FileLock) Release() error

Release drops the flock and closes the underlying file descriptor.

Jump to

Keyboard shortcuts

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