zookeeper

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnDelay    = 3
	MaxFailTimes = 15
)

Variables

This section is empty.

Functions

func HandleClientRestart

func HandleClientRestart(r zkClientFacade)

func StateToString

func StateToString(state zk.State) string

func ValidateZookeeperClient

func ValidateZookeeperClient(container zkClientFacade, opts ...Option) error

Types

type Option

type Option func(*Options)

func WithTestCluster

func WithTestCluster(ts *zk.TestCluster) Option

func WithZkName

func WithZkName(name string) Option

type Options

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

type ZkEventListener

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

func NewZkEventListener

func NewZkEventListener(client *ZookeeperClient) *ZkEventListener

func (*ZkEventListener) Close

func (l *ZkEventListener) Close()

func (*ZkEventListener) ListenServiceEvent

func (l *ZkEventListener) ListenServiceEvent(zkPath string, listener remoting.DataListener)

this func is invoked by ZkConsumerRegistry::Register/ZkConsumerRegistry::get/ZkConsumerRegistry::getListener registry.go:Listen -> listenServiceEvent -> listenDirEvent -> ListenServiceNodeEvent

|
--------> ListenServiceNodeEvent

func (*ZkEventListener) ListenServiceNodeEvent

func (l *ZkEventListener) ListenServiceNodeEvent(zkPath string, listener ...remoting.DataListener) bool

func (*ZkEventListener) SetClient

func (l *ZkEventListener) SetClient(client *ZookeeperClient)

type ZookeeperClient

type ZookeeperClient struct {
	ZkAddrs    []string
	sync.Mutex // for conn
	Conn       *zk.Conn
	Timeout    time.Duration

	Wait sync.WaitGroup
	// contains filtered or unexported fields
}

func NewMockZookeeperClient

func NewMockZookeeperClient(name string, timeout time.Duration, opts ...Option) (*zk.TestCluster, *ZookeeperClient, <-chan zk.Event, error)

func (*ZookeeperClient) Close

func (z *ZookeeperClient) Close()

func (*ZookeeperClient) Create

func (z *ZookeeperClient) Create(basePath string) error

func (*ZookeeperClient) Delete

func (z *ZookeeperClient) Delete(basePath string) error

func (*ZookeeperClient) Done

func (z *ZookeeperClient) Done() <-chan struct{}

func (*ZookeeperClient) ExistW

func (z *ZookeeperClient) ExistW(zkPath string) (<-chan zk.Event, error)

func (*ZookeeperClient) GetChildren

func (z *ZookeeperClient) GetChildren(path string) ([]string, error)

func (*ZookeeperClient) GetChildrenW

func (z *ZookeeperClient) GetChildrenW(path string) ([]string, <-chan zk.Event, error)

func (*ZookeeperClient) GetContent

func (z *ZookeeperClient) GetContent(zkPath string) ([]byte, *zk.Stat, error)

func (*ZookeeperClient) HandleZkEvent

func (z *ZookeeperClient) HandleZkEvent(session <-chan zk.Event)

func (*ZookeeperClient) RegisterEvent

func (z *ZookeeperClient) RegisterEvent(zkPath string, event *chan struct{})

func (*ZookeeperClient) RegisterTemp

func (z *ZookeeperClient) RegisterTemp(basePath string, node string) (string, error)

func (*ZookeeperClient) RegisterTempSeq

func (z *ZookeeperClient) RegisterTempSeq(basePath string, data []byte) (string, error)

func (*ZookeeperClient) UnregisterEvent

func (z *ZookeeperClient) UnregisterEvent(zkPath string, event *chan struct{})

func (*ZookeeperClient) ZkConnValid

func (z *ZookeeperClient) ZkConnValid() bool

Jump to

Keyboard shortcuts

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