zookeeper

package
v0.0.0-...-6113c70 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Continue = true
	Stop     = false
)

Variables

View Source
var (
	ErrClientDisConnect = errors.New("zk client is not connected to server")
	ErrExecTimeout      = errors.New("exec timeout")
)

Functions

func DefaultOption

func DefaultOption() *option

func WarpperTimeout

func WarpperTimeout(f func(), timeout time.Duration) error

WarpperTimeout exec function with timeout

func WithConnectNum

func WithConnectNum(num int) func(*option)

WithConnectNum set connect num

func WithConnectTimeout

func WithConnectTimeout(timeout time.Duration) func(*option)

WithConnectTimeout set connect timeout

func WithExecTimeout

func WithExecTimeout(timeout time.Duration) func(*option)

WithExecTimeout set exec timeout

Types

type HandlerChildren

type HandlerChildren func(path string, children []string) (continueWatch bool)

HandlerChildren handler watch children event

type HandlerValue

type HandlerValue func(path string, data string) (continueWatch bool)

HandlerValue handler watch value event

type Option

type Option func(*option)

type ZkClient

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

ZkClient zk client struct

func NewClient

func NewClient(ctx context.Context, servers []string, timeout time.Duration, opts ...Option) (*ZkClient, error)

NewClient new zk client

func (*ZkClient) CreatePersistentNode

func (zc *ZkClient) CreatePersistentNode(path string, data string) (err error)

CreatePersistentNode create persistent node with data

func (*ZkClient) CreatePersistentSeqNode

func (zc *ZkClient) CreatePersistentSeqNode(path string, data string) (rpath string, err error)

CreatePersistentSeqNode create persistent seq node

func (*ZkClient) CreateTempNode

func (zc *ZkClient) CreateTempNode(path string, data string) (err error)

CreateTempNode create temp node

func (*ZkClient) CreateTempSeqNode

func (zc *ZkClient) CreateTempSeqNode(path string, data string) (rpath string, err error)

CreateTempSeqNode create temp seq node

func (*ZkClient) Delete

func (zc *ZkClient) Delete(path string) (err error)

Delete delete node

func (*ZkClient) GetChildren

func (zc *ZkClient) GetChildren(path string) (children []string, version int32, err error)

GetChildren get children path

func (*ZkClient) GetValue

func (zc *ZkClient) GetValue(path string) (data string, version int32, err error)

GetValue get path data

func (*ZkClient) IsExists

func (zc *ZkClient) IsExists(path string) (b bool, err error)

IsExists judge path is exists

func (*ZkClient) Update

func (zc *ZkClient) Update(path string, data string) (err error)

Update update path value

func (*ZkClient) WatchChildren

func (zc *ZkClient) WatchChildren(path string, handler HandlerChildren) error

WatchChildren watch children

func (*ZkClient) WatchValue

func (zc *ZkClient) WatchValue(path string, handler HandlerValue) error

WatchValue watch value change

Jump to

Keyboard shortcuts

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