lock

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLocked = errors.New("already locked")

Functions

This section is empty.

Types

type LocalLock

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

func (*LocalLock) Lock

func (l *LocalLock) Lock(ctx context.Context) error

func (*LocalLock) TryLock

func (l *LocalLock) TryLock(ctx context.Context) error

func (*LocalLock) Unlock

func (l *LocalLock) Unlock() error

type LocalLockFactory

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

func NewLocalLockFactory

func NewLocalLockFactory(ll *LocalLocks) *LocalLockFactory

func (*LocalLockFactory) NewLock

func (l *LocalLockFactory) NewLock(key string) Lock

type LocalLocks

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

func NewLocalLocks

func NewLocalLocks() *LocalLocks

type Lock

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

type LockFactory

type LockFactory interface {
	NewLock(key string) Lock
}

type PGLock

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

func NewPGLock

func NewPGLock(db *sql.DB, key string) *PGLock

func (*PGLock) Lock

func (l *PGLock) Lock(ctx context.Context) error

func (*PGLock) TryLock

func (l *PGLock) TryLock(ctx context.Context) error

func (*PGLock) Unlock

func (l *PGLock) Unlock() error

type PGLockFactory

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

func NewPGLockFactory

func NewPGLockFactory(db *sql.DB) *PGLockFactory

func (*PGLockFactory) NewLock

func (l *PGLockFactory) NewLock(key string) Lock

Jump to

Keyboard shortcuts

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