etcd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(urls []*url.URL) (lock.DLocker, error)

New new etcd locker

Types

type LockManager

type LockManager struct {
	// contains filtered or unexported fields
}

LockManager ETCD v3 lock manager

func (*LockManager) Close

func (l *LockManager) Close() error

Close close client

func (*LockManager) Lock

func (l *LockManager) Lock(ctx context.Context, id string, ttl int) error

Lock try to lock and wait until resource is available to lock

func (*LockManager) TryLock

func (l *LockManager) TryLock(ctx context.Context, id string, ttl int) error

TryLock try to lock, and return immediately if resource already locked

func (*LockManager) Unlock

func (l *LockManager) Unlock(ctx context.Context, id string) error

Unlock unlock resource

Jump to

Keyboard shortcuts

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