etcd

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 10

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)

func (*Etcd) NewQueue

func (etcd *Etcd) NewQueue(topic string) *Queue

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

type Queue

type Queue struct {
	*recipe.Queue
}

func (*Queue) Dequeue

func (q *Queue) Dequeue() (string, error)

Dequeue returns Enqueue()'d elements in FIFO order. If the queue is empty, Dequeue blocks until elements are available.

func (*Queue) Enqueue

func (q *Queue) Enqueue(val string) error

Jump to

Keyboard shortcuts

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