watcher

package
v0.13.6-0...-d3ad96a Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 6 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 ChildrenChangeArgs

type ChildrenChangeArgs struct {
	Deep     int
	Name     string
	Parent   string
	Children []string
	Version  int32
	OP       int
}

ChildrenChangeArgs 值变化通知事件

func NewCArgsByChange

func NewCArgsByChange(op int, deep int, parent string, chilren []string, v int32) *ChildrenChangeArgs

func NewCArgsByDelete

func NewCArgsByDelete(deep int, parent string) *ChildrenChangeArgs

type ChildrenWatcher

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

ChildrenWatcher 监控器

func NewChildrenWatcher

func NewChildrenWatcher(path string, deep int, timeSpan time.Duration, registry registry.IRegistry, logger logger.ILogger) *ChildrenWatcher

NewChildrenWatcher 初始化监控

func (*ChildrenWatcher) Changed

func (w *ChildrenWatcher) Changed(children []string, version int32)

Changed 子节点发生变化

func (*ChildrenWatcher) Close

func (w *ChildrenWatcher) Close()

Close 关闭监控

func (*ChildrenWatcher) Deleted

func (w *ChildrenWatcher) Deleted()

Deleted 节点删除

func (*ChildrenWatcher) Start

func (w *ChildrenWatcher) Start() (c chan *ChildrenChangeArgs, err error)

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

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.ILogger) *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