kv

package
v0.0.0-...-ebb7ec8 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Discovery 发现服务结构定义 集成LibStore库实现

func (*Discovery) Initialize

func (d *Discovery) Initialize(uris string, heartbeat time.Duration, ttl time.Duration, configopts map[string]string) error

Initialize 初始化一个Discovery实例 根据backend类型构造出libkv的Store

func (*Discovery) Register

func (d *Discovery) Register(key string, data []byte, stopCh <-chan struct{}) <-chan error

Register 服务注册 节点根据heartbeat轮询定时注册, 节点过期由ttl阈值决定 key: 集群节点唯一编码 data: 节点数据,可为nil stopCh: 退出心跳注册

func (*Discovery) WatchExtend

func (d *Discovery) WatchExtend(key string, stopCh <-chan struct{}) (<-chan []byte, <-chan error)

WatchExtend 扩展路径监视 监视扩展路径变化 key: 一个被监视的全路径 stopCh: 退出服务发现

func (*Discovery) WatchNodes

func (d *Discovery) WatchNodes(stopCh <-chan struct{}) (<-chan backends.Entries, <-chan error)

WatchNodes 节点监视 由发现服务端调用, 实现WatchTree监视所有节点变化 stopCh: 退出服务发现

Jump to

Keyboard shortcuts

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