lockers

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCanceled = errors.New("canceled")
)
View Source
var LockerTypes = []string{
	"consul",
}
View Source
var Lockers = map[string]Initializer{}

Functions

func DecodeConfig

func DecodeConfig(src, dst interface{}) error

func Register

func Register(name string, initFn Initializer)

Types

type Initializer

type Initializer func() Locker

type Locker

type Locker interface {
	Init(context.Context, map[string]interface{}, ...Option) error
	Lock(context.Context, string, []byte) (bool, error)
	KeepLock(context.Context, string) (chan struct{}, chan error)
	Unlock(string) error
	Stop() error
	SetLogger(*log.Logger)
}

type Option

type Option func(Locker)

func WithLogger

func WithLogger(logger *log.Logger) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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