widelock

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 3 Imported by: 0

README

widelock

A key based lock interface with local (memory) and distributed (consul、etcd) implementation

Ci codecov Go Report Card Go Reference MIT License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyClosed    = errors.New("widelock: set already closed")
	ErrAlreadyUnlocked  = errors.New("widelock: already unlocked")
	ErrLockNotHeld      = errors.New("widelock: lock not held")
	ErrLockNotSetExpiry = errors.New("widelock: lock not set expiry")
	ErrInvalidDuration  = errors.New("widelock: invalid duration")
)

Functions

This section is empty.

Types

type Mutex

type Mutex interface {
	Lock(context.Context) error
	TryLock(context.Context) (bool, error)
	Unlock() error
	Extend(context.Context, time.Duration) error
	Valid(context.Context) bool
	Name() string
}

type MutexSet

type MutexSet interface {
	NewMutex(key string, opts ...Option) Mutex
	Close() error
}

type Option

type Option interface {
	Apply(Mutex)
}

type OptionSet

type OptionSet interface {
	Apply(MutexSet)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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