Help us shape the future of Go! Take the 2026 Go Developer Survey

gxzookeeper

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package gxzookeeper provides a zookeeper registry

Package gxzookeeper provides a zookeeper watcher

Index

Constants

View Source
const (
	MAX_TIMES                   = 15 // 设置(wathcer)watchDir()等待时长
	Wactch_Event_Channel_Size   = 32 // 用于设置通知selector的event channel的size
	ZKCLIENT_EVENT_CHANNEL_SIZE = 4  // 设置用于zk client与watcher&consumer&provider之间沟通的channel的size
)

Variables

This section is empty.

Functions

func NewRegistry

func NewRegistry(opts ...gxregistry.Option) (gxregistry.Registry, error)

func NewWatcher

func NewWatcher(r gxregistry.Registry, opts ...gxregistry.WatchOption) (gxregistry.Watcher, error)

Types

type Registry

type Registry struct {
	sync.Mutex // lock for client + register
	// contains filtered or unexported fields
}

func (*Registry) Client added in v0.3.2

func (r *Registry) Client() *gxzookeeper.Client

func (*Registry) Close

func (r *Registry) Close() error

func (*Registry) Deregister

func (r *Registry) Deregister(s gxregistry.Service) error

func (*Registry) Done

func (r *Registry) Done() <-chan struct{}

check whether the session has been closed.

func (*Registry) GetServices

func (r *Registry) GetServices(attr gxregistry.ServiceAttr) ([]gxregistry.Service, error)

func (*Registry) Options

func (r *Registry) Options() gxregistry.Options

func (*Registry) Register

func (r *Registry) Register(s gxregistry.Service) error

func (*Registry) String

func (r *Registry) String() string

func (*Registry) Watch

func (r *Registry) Watch(opts ...gxregistry.WatchOption) (gxregistry.Watcher, error)

type Watcher

type Watcher struct {
	sync.Mutex // lock path set

	sync.Once // for Close
	// contains filtered or unexported fields
}

watcher的watch系列函数暴露给zk registry,而Next函数则暴露给selector

func (*Watcher) Close

func (w *Watcher) Close()

func (*Watcher) IsClosed

func (w *Watcher) IsClosed() bool

check whether the session has been closed.

func (*Watcher) Notify

func (w *Watcher) Notify() (*gxregistry.EventResult, error)

func (*Watcher) Valid

func (w *Watcher) Valid() bool

Jump to

Keyboard shortcuts

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