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
Click to show internal directories.
Click to hide internal directories.