etcd

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcd

func NewEtcd(timeout time.Duration, leaseTLL int64, config *clientv3.Config) error

NewEtcd init etcd if config is nil,use default config setting

Types

type Action

type Action struct {

	//watch callback action
	Act namespace.WatcherAction

	//callback data
	B map[string][]byte
}

type Etcd

type Etcd struct {
	// contains filtered or unexported fields
}
var DefaultEtcd *Etcd

func (*Etcd) Client

func (s *Etcd) Client() *clientv3.Client

Client get etcd client

func (*Etcd) CloseEtcd added in v1.1.6

func (s *Etcd) CloseEtcd()

func (*Etcd) Delete

func (s *Etcd) Delete(key string) error

func (*Etcd) GetWithKey

func (s *Etcd) GetWithKey(key string) ([]byte, error)

GetWithKey get value with key

func (*Etcd) GetWithLastKey

func (s *Etcd) GetWithLastKey(key string) ([]byte, error)

GetWithLastKey get value with last key

func (*Etcd) GetWithList

func (s *Etcd) GetWithList(key string, opts ...clientv3.OpOption) (map[string][]byte, error)

func (*Etcd) Put

func (s *Etcd) Put(key, value string) error

Put put one key/value to etcd with no lease setting

func (*Etcd) PutTimeout added in v0.2.5

func (s *Etcd) PutTimeout(key, value string, leaseTLL int64) error

PutTimeout put one key/value to etcd with lease setting

func (*Etcd) PutWithLease

func (s *Etcd) PutWithLease(key, value string) error

PutWithLease put one key/value to etcd with lease setting use just one leaseId control all whit lease key/value data

type Watch

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

func NewEtcdWatch

func NewEtcdWatch(prefix string, client *clientv3.Client) *Watch

func (*Watch) CloseWatch added in v1.1.6

func (w *Watch) CloseWatch()

func (*Watch) Watch

func (w *Watch) Watch(prefix string) chan *Action

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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