lock

package
v0.47.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package lock provides file-based locking for bosun operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLock

func WithLock(manifestDir, operation string, fn func() error) error

WithLock executes a function while holding the lock. The lock is automatically released when the function returns.

Types

type Lock

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

Lock represents a file-based lock. The Lock struct is safe for concurrent use from multiple goroutines.

func New

func New(manifestDir, operation string) *Lock

New creates a new lock for the given operation in the manifest directory.

func (*Lock) Acquire

func (l *Lock) Acquire() error

Acquire attempts to acquire the lock. Returns an error if the lock is already held by another process. This method is safe for concurrent calls.

func (*Lock) Release

func (l *Lock) Release() error

Release releases the lock. This method is safe for concurrent calls.

Jump to

Keyboard shortcuts

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