lockr

package
v1.0.0-beta.215 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLockTimeout = errors.New("lock operation timed out")

ErrLockTimeout is returned when a lock operation times out

Functions

This section is empty.

Types

type Key

type Key interface {
	String() string
	Hash64() uint64
}

Key is a unique identifier for a resource and a scope that can be locked

func NewKey

func NewKey(scope string, scopes ...string) (Key, error)

NewKey constructs a key for the given scopes. Scope is always required and must be non-empty.

type Locker

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

Locker is the generic interface for distributed business level locks.

func NewLocker

func NewLocker(cfg *LockerConfig) (*Locker, error)

func (*Locker) LockForTX

func (l *Locker) LockForTX(ctx context.Context, key Key) error

LockForTX locks the key for the duration of the transaction.

type LockerConfig

type LockerConfig struct {
	Logger *slog.Logger
}

func (*LockerConfig) Validate

func (c *LockerConfig) Validate() error

Jump to

Keyboard shortcuts

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