rsync

package
v1.1.31 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLock = errors.New("lock failure")

Functions

func Acquire

func Acquire(key string, ttl int, f func() error) error

Acquire is a distributed lock by etcd try to lock with a key if timeout the lock will be return f() is the function what will be lock it will return a error key is prefix or a unique id tll is lock timeout setting tryLockTimes is backoff to retry lock

func AcquireDelay added in v1.0.1

func AcquireDelay(key string, ttl int, f func() error) error

func AcquireOnce added in v1.0.3

func AcquireOnce(key string, ttl int, f func() error) error

if lock get failure during time.Second,it will be return lock err

Types

This section is empty.

Jump to

Keyboard shortcuts

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