watcher

package
v0.0.0-...-e43fadc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ADD 新增节点
	ADD = iota + 1
	//CHANGE 节点变更
	CHANGE
	//DEL 删除节点
	DEL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfWatcher

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

ConfWatcher 配置监控服务

func NewConfWatcher

func NewConfWatcher(platName string, systemName string, serverTypes []string, clusterName string, rgst registry.IRegistry, logger *logger.Logger) (w *ConfWatcher, err error)

NewConfWatcher 初始化服务器监控程序

func (*ConfWatcher) Close

func (c *ConfWatcher) Close()

Close 关闭监控器

func (*ConfWatcher) Notify

func (c *ConfWatcher) Notify() (chan *ContentChangeArgs, error)

Notify 服务器变更通知

type ContentChangeArgs

type ContentChangeArgs struct {
	Path    string
	Content []byte
	Version int32
	OP      int
}

ContentChangeArgs 值变化通知事件

type Watcher

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

Watcher 监控器

func NewWatcher

func NewWatcher(path string, timeSpan time.Duration, registry registry.IRegistry, logger *logger.Logger) *Watcher

NewWatcher 初始化监控

func (*Watcher) Close

func (w *Watcher) Close()

Close 关闭监控

func (*Watcher) Start

func (w *Watcher) Start() (c chan *ContentChangeArgs, err error)

Start 监控配置项变化,当发生错误时持续监控节点变化,只有明确节点不存在时才会通知关闭

Jump to

Keyboard shortcuts

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