Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryLocker ¶
type InMemoryLocker struct {
// contains filtered or unexported fields
}
InMemoryLocker is an implementation of the Locker interface that uses an in-memory mutex map.
type Locker ¶
type Locker interface {
// WithLock acquires a lock for the given key, executes the provided function,
// and guarantees the lock is released afterward.
WithLock(key string, f func() error) error
}
Locker defines the interface for a distributed, blocking locking mechanism.
func NewInMemoryLocker ¶
func NewInMemoryLocker() Locker
NewInMemoryLocker creates a new instance of InMemoryLocker.
func NewPostgresLocker ¶
NewPostgresLocker creates a new instance of PostgresLocker.
type PostgresLocker ¶
type PostgresLocker struct {
// contains filtered or unexported fields
}
PostgresLocker is an implementation of the Locker interface that uses PostgreSQL advisory locks.
Click to show internal directories.
Click to hide internal directories.