etcd

package
v0.0.0-...-3ac4113 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Etcd

type Etcd struct {
	*clientv3.Client
}

func Connect

func Connect(endpoints []string, prefix string) (*Etcd, error)

func (*Etcd) Dlock

func (etcd *Etcd) Dlock(ctx context.Context, key string, cb callback) error

func (*Etcd) DlockWithTimeout

func (etcd *Etcd) DlockWithTimeout(key string, timeout time.Duration, cb callback) error

func (*Etcd) NewMutex

func (etcd *Etcd) NewMutex(key string) (*Mutex, error)

type Mutex

type Mutex struct {
	*concurrency.Mutex
}

func (*Mutex) Lock

func (m *Mutex) Lock(ctx context.Context) error

Lock locks the mutex with a cancelable context. If the context is canceled while trying to acquire the lock, the mutex tries to clean its stale lock entry.

func (*Mutex) Unlock

func (m *Mutex) Unlock(ctx context.Context) error

Jump to

Keyboard shortcuts

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