lock

package
v0.0.0-...-c8a8185 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Providers     = map[string]NewLockFunc{}
	ErrLockFailed = errors.New("lock failed")
	ErrLockClosed = errors.New("lock closed")
)

Functions

func Acquire

func Acquire(ctx context.Context, lock Lock) error

Acquire attempts to acquire the lock until lock is closed or an error that cannot be recovered from occurs

Types

type Lock

type Lock interface {
	Connect(ctx context.Context) (err error)
	Disconnect(ctx context.Context) (err error)
	Lock(ctx context.Context) (err error)
	Unlock(ctx context.Context) (err error)
	HasLock() bool
}

type NewLockFunc

type NewLockFunc func(opts *Options) (Lock, error)

type Options

type Options struct {
	Config interface{}
	Logger logger.Logger
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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