etcd

package
v5.2.2-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: LGPL-3.0 Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyExists key already exists
	ErrKeyExists = errors.New("key already exists")
	// ErrWaitMismatch unexpected wait result
	ErrWaitMismatch = errors.New("unexpected wait result")
	// ErrTooManyClients too many clients
	ErrTooManyClients = errors.New("too many clients")
	// ErrNoWatcher no watcher channel
	ErrNoWatcher = errors.New("no watcher channel")
	//ErrNoEndpoints no etcd endpoint
	ErrNoEndpoints = errors.New("no etcd endpoint")
)
View Source
var ErrNoUpdateForLongTime = fmt.Errorf("not updated for a long time")

ErrNoUpdateForLongTime no update for long time , can reobservation of synchronous data

Functions

func HandleEtcdError

func HandleEtcdError(err error)

HandleEtcdError 处理etcd错误

func NewClient

func NewClient(ctx context.Context, clientArgs *ClientArgs) (*v3.Client, error)

NewClient new etcd client v3 for all rainbond module, attention: do not support v2

func WaitPrefixEvents

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

WaitPrefixEvents WaitPrefixEvents

Types

type ClientArgs

type ClientArgs struct {
	Endpoints        []string      // args for clientv3.Config
	DialTimeout      time.Duration // args for clientv3.Config
	AutoSyncInterval time.Duration // args for clientv3.Config
	CaFile           string        // args for clientv3.Config.TLS
	CertFile         string        // args for clientv3.Config.TLS
	KeyFile          string        // args for clientv3.Config.TLS
}

ClientArgs etcd client arguments

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

NewQueue new 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

Enqueue en queue

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

Delete delete

func (*RemoteKV) Key

func (rk *RemoteKV) Key() string

Key key

func (*RemoteKV) Put

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

Put put

func (*RemoteKV) Revision

func (rk *RemoteKV) Revision() int64

Revision revision

func (*RemoteKV) Value

func (rk *RemoteKV) Value() string

Value value

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