locker

package
v0.2.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Namespace string = "_Locker"
	TTL              = time.Second * 30
)

Variables

View Source
var (
	ErrStatusBusy = errors.New("status busy")
)

Functions

func MutexLock

func MutexLock(lockID string, ttl int64, backend Backend) error

func MutexTryLock

func MutexTryLock(lockID string, ttl int64, deadline int64, backend Backend) bool

func MutexUnlock

func MutexUnlock(lockID string, backend Backend) error

Types

type Backend

type Backend interface {
	Get(key []byte) (*store.Value, error)
	TrySetWithTTL(key, value []byte, ttl uint32) error
	Del(key []byte) error
	Watch(key []byte) (notify store.WatcherNotify, err error)
}

Jump to

Keyboard shortcuts

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