lock

package
v4.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrAlreadyLocked

type ErrAlreadyLocked struct{}

func (*ErrAlreadyLocked) Error

func (e *ErrAlreadyLocked) Error() string

type EtcdLock

type EtcdLock struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func (*EtcdLock) Release

func (l *EtcdLock) Release() error

type EtcdLocker

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

func (*EtcdLocker) Acquire

func (locker *EtcdLocker) Acquire(key string, ttl int) (Lock, error)

func (*EtcdLocker) Wait

func (locker *EtcdLocker) Wait(key string) error

func (*EtcdLocker) WaitAcquire

func (locker *EtcdLocker) WaitAcquire(key string, ttl int) (Lock, error)

type EtcdLockerOpt

type EtcdLockerOpt func(locker *EtcdLocker)

func WithCooldownTryLockDuration

func WithCooldownTryLockDuration(timeout time.Duration) EtcdLockerOpt

func WithMaxTryLockTimeout

func WithMaxTryLockTimeout(timeout time.Duration) EtcdLockerOpt

func WithTryLockTimeout

func WithTryLockTimeout(timeout time.Duration) EtcdLockerOpt

type Lock

type Lock interface {
	Release() error
}

type Locker

type Locker interface {
	Acquire(key string, ttl int) (Lock, error)
	WaitAcquire(key string, ttl int) (Lock, error)
	Wait(key string) error
}

func NewEtcdLocker

func NewEtcdLocker(client *etcd.Client, opts ...EtcdLockerOpt) Locker

Directories

Path Synopsis
Package lockmock is a generated GoMock package.
Package lockmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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