definition

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinLockExpire ...
	MinLockExpire = 100 * time.Millisecond
)

Variables

View Source
var (
	// ErrLockNotHeld is returned when trying to release an inactive lock.
	ErrLockNotHeld = errors.New("locker not held")
	// ErrLockTooShort expire should longer than 100ms
	ErrLockTooShort = errors.New("locker expire is too short")
	// ErrLockAlreadyExpired lock already expired
	ErrLockAlreadyExpired = errors.New("locker already expired")
)

Functions

This section is empty.

Types

type Lock

type Lock interface {
	// Unlock ...
	Unlock(ctx context.Context) error
	// Renew ...
	Renew(ctx context.Context, ttls ...time.Duration) error
}

Lock lock interface

type Locker

type Locker interface {
	// Acquire ...
	Acquire(ctx context.Context, key string, expire, waitTimeout time.Duration) (Lock, error)
	// AcquireWithRenew acquire lock with renew the lock
	AcquireWithRenew(ctx context.Context, key string, expire, waitTimeout time.Duration) error
}

Locker locker interface

Directories

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

Jump to

Keyboard shortcuts

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