etcd

package
v3.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyExists      = errors.New("key already exists")
	ErrWaitMismatch   = errors.New("unexpected wait result")
	ErrTooManyClients = errors.New("too many clients")
	ErrNoWatcher      = errors.New("no watcher channel")
)

Functions

func HandleEtcdError

func HandleEtcdError(err error)

HandleEtcdError 处理etcd错误

func WaitEvents

func WaitEvents(c *clientv3.Client, key string, rev int64, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

WaitEvents waits on a key until it observes the given events and returns the final one.

func WaitPrefixEvents

func WaitPrefixEvents(c *clientv3.Client, prefix string, rev int64, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

WaitPrefixEvents WaitPrefixEvents

func WatchPrefixEvents

func WatchPrefixEvents(c *clientv3.Client, prefix string, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

WatchPrefixEvents watch prefix

Types

type EphemeralKV

type EphemeralKV struct{ RemoteKV }

EphemeralKV is a new key associated with a session lease

type Queue

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

Queue implements a multi-reader, multi-writer distributed queue.

func NewQueue

func NewQueue(client *v3.Client, keyPrefix string, ctx context.Context) *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

type RemoteKV

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

RemoteKV is a key/revision pair created by the client and stored on etcd

func (*RemoteKV) Delete

func (rk *RemoteKV) Delete() error

func (*RemoteKV) Key

func (rk *RemoteKV) Key() string

func (*RemoteKV) Put

func (rk *RemoteKV) Put(val string) error

func (*RemoteKV) Revision

func (rk *RemoteKV) Revision() int64

func (*RemoteKV) Value

func (rk *RemoteKV) Value() string

Directories

Path Synopsis
Package etcdlock Master election using etcd.
Package etcdlock Master election using etcd.

Jump to

Keyboard shortcuts

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