watcher

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Key       string   // 需要观察的键
	Endpoints []string `json:",optional"` // 节点列表
	Username  string   `json:",optional"` // 用户名
	Password  string   `json:",optional"` // 密码
}

Config etcd 观察器配置

type Option

type Option func(w *Watcher)

Option 可选配置

func WithClient

func WithClient(client *clientv3.Client) Option

WithClient 使用指定 etcd 客户端

type Watcher

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

Watcher etcd 观察器

func MustNewWatcher

func MustNewWatcher(c Config, opts ...Option) *Watcher

MustNewWatcher 新建 etcd 观察器

func NewWatcher

func NewWatcher(c Config, opts ...Option) (*Watcher, error)

NewWatcher 新建 etcd 观察器

func (*Watcher) Close

func (w *Watcher) Close()

Close 关闭 etcd 观察器

func (*Watcher) SetUpdateCallback

func (w *Watcher) SetUpdateCallback(callback func(string)) error

SetUpdateCallback 设置 etcd 更新回调函数

func (*Watcher) Update

func (w *Watcher) Update() error

Update 触发 etcd 更新事件

Jump to

Keyboard shortcuts

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