etcd

package
v0.0.0-...-a3a5c94 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 12 Imported by: 0

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 a long time , can re-observe synchronous data

Functions

func HandleEtcdError

func HandleEtcdError(err error)

HandleEtcdError

func NewClient

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

NewClient new etcd client v3 for all kato 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

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

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

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

func (*RemoteKV) Key

func (rk *RemoteKV) Key() string

Key

func (*RemoteKV) Put

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

Put

func (*RemoteKV) Revision

func (rk *RemoteKV) Revision() int64

Revision

func (*RemoteKV) Value

func (rk *RemoteKV) Value() string

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