etcd

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcd

func NewEtcd(conf *Config) (*clientv3.Client, error)

func NewEtcdByOption added in v0.0.3

func NewEtcdByOption(opts ...Option) (*clientv3.Client, error)

Types

type Config

type Config struct {
	Addr []string `yaml:"addr"`
	TTL  int      `yaml:"ttl"`
}

type Option added in v0.0.3

type Option func(*clientv3.Config)

func WithDialTimeout added in v0.0.3

func WithDialTimeout(d time.Duration) Option

func WithEndpoints added in v0.0.3

func WithEndpoints(addr []string) Option

type Watcher

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

func NewWatcher

func NewWatcher(ctx context.Context, key string, client *clientv3.Client) (*Watcher, error)

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context, f func(key string, val []byte), g func(key string)) <-chan error

Run f func put g func delete

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) ([]*mvccpb.KeyValue, error)

func (*Watcher) Stop

func (w *Watcher) Stop() error

Jump to

Keyboard shortcuts

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