Documentation
¶
Overview ¶
Package lock provides a distributed lock abstraction built on a Maker/Locker pair.
A Maker creates Locker instances by name, and a Locker acquires and releases a lock. The package holds a global maker so that lockers can be created through Make without passing the maker around explicitly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Locker ¶
type Locker interface {
// Acquire acquires the lock.
Acquire(ctx context.Context) error
// TryAcquire tries to acquire the lock with an optional expiration.
TryAcquire(ctx context.Context, expiration ...time.Duration) error
// Release releases the lock.
Release(ctx context.Context) error
}
Locker is a distributed lock that can be acquired and released.
Click to show internal directories.
Click to hide internal directories.