lock

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

type Locker interface {
	// Lock acquires the lock, blocking until it's available or context is cancelled.
	Lock(ctx context.Context) error

	// TryLock attempts to acquire the lock without blocking.
	// Returns true if the lock was acquired, false otherwise.
	TryLock(ctx context.Context) (bool, error)

	// Unlock releases the lock.
	Unlock(ctx context.Context) error
}

Locker represents a distributed lock that can be acquired and released.

type Service

type Service interface {
	// NewLock creates a new lock with the given key.
	NewLock(key string) Locker
}

Service provides methods to create distributed locks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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