rainbond: github.com/goodrain/rainbond/util/etcd Index | Files | Directories

package etcd

import "github.com/goodrain/rainbond/util/etcd"


Package Files

client.go error.go etcd.go queue.go watch.go


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")

func HandleEtcdError Uses

func HandleEtcdError(err error)

HandleEtcdError 处理etcd错误

func WaitEvents Uses

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 Uses

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

WaitPrefixEvents WaitPrefixEvents

func WatchPrefixEvents Uses

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

WatchPrefixEvents watch prefix

type EphemeralKV Uses

type EphemeralKV struct{ RemoteKV }

EphemeralKV is a new key associated with a session lease

type Queue Uses

type Queue struct {
    // contains filtered or unexported fields

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

func NewQueue Uses

func NewQueue(client *v3.Client, keyPrefix string, ctx context.Context) *Queue

func (*Queue) Dequeue Uses

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 Uses

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

type RemoteKV Uses

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 Uses

func (rk *RemoteKV) Delete() error

func (*RemoteKV) Key Uses

func (rk *RemoteKV) Key() string

func (*RemoteKV) Put Uses

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

func (*RemoteKV) Revision Uses

func (rk *RemoteKV) Revision() int64

func (*RemoteKV) Value Uses

func (rk *RemoteKV) Value() string


etcdlockPackage etcdlock Master election using etcd.

Package etcd imports 11 packages (graph) and is imported by 2 packages. Updated 2018-04-24. Refresh now. Tools for package owners.