locker

package
v0.1.164 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LOCKER_INMEMORY = "inmemory"
	LOCKER_POSTGRES = "postgres"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryLocker

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

func NewInMemoryLocker

func NewInMemoryLocker() *InMemoryLocker

func (*InMemoryLocker) AcquireLock

func (m *InMemoryLocker) AcquireLock(ctx context.Context, key string) (Lock, error)

type Lock

type Lock interface {
	ReleaseLock(ctx context.Context) error
}

type Locker

type Locker interface {
	AcquireLock(ctx context.Context, key string) (Lock, error)
}

type LockerOption added in v0.1.152

type LockerOption func(*PostgresLocker)

func WithConnMaxIdleTime added in v0.1.152

func WithConnMaxIdleTime(d time.Duration) LockerOption

func WithConnMaxLifetime added in v0.1.152

func WithConnMaxLifetime(d time.Duration) LockerOption

func WithHeartbeatInterval added in v0.1.164

func WithHeartbeatInterval(d time.Duration) LockerOption

func WithLeaseTTL added in v0.1.164

func WithLeaseTTL(d time.Duration) LockerOption

func WithMaxIdleConns added in v0.1.152

func WithMaxIdleConns(n int) LockerOption

func WithMaxOpenConns added in v0.1.152

func WithMaxOpenConns(n int) LockerOption

type PostgresLocker

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

func NewPostgresLocker

func NewPostgresLocker(dsn string, opts ...LockerOption) (*PostgresLocker, error)

func (*PostgresLocker) AcquireLock

func (p *PostgresLocker) AcquireLock(ctx context.Context, key string) (Lock, error)

Jump to

Keyboard shortcuts

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