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: 10 Imported by: 0

Documentation

Overview

Package gxzookeeper provides a zookeeper driver based on samuel/go-zookeeper/zk

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDeadlock is returned by Lock when trying to lock twice without unlocking first
	ErrDeadlock = jerrors.New("zk: trying to acquire a lock twice")
	// ErrNotLocked is returned by Unlock when trying to release a lock that has not first be acquired.
	ErrNotLocked = jerrors.New("zk: not locked")
)

Functions

func GetMaxSequenceNumber added in v0.3.2

func GetMaxSequenceNumber(children []string, prefix string) (seq int, index int, retError error)

get the maximum sequence number.

func GetMinSequenceNumber added in v0.3.2

func GetMinSequenceNumber(children []string, prefix string) (seq int, index int, retError error)

get the minimum sequence number.

Types

type Client

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

func NewClient

func NewClient(conn *zk.Conn) *Client

func (*Client) Campaign added in v0.3.2

func (c *Client) Campaign(basePath string, timeout time.Duration) error

if @timeout <= 0, Campaign will loop to get the leadership until success.

func (*Client) CreateZkPath

func (c *Client) CreateZkPath(basePath string) error

节点须逐级创建

func (*Client) DeleteZkPath

func (c *Client) DeleteZkPath(path string) error

像创建一样,删除节点的时候也只能从叶子节点逐级回退删除 当节点还有子节点的时候,删除是不会成功的

func (*Client) Exist added in v0.3.2

func (c *Client) Exist(path string) (bool, error)

func (*Client) ExistW

func (c *Client) ExistW(path string) (<-chan zk.Event, error)

func (*Client) Get

func (c *Client) Get(path string) ([]byte, error)

func (*Client) GetChildren

func (c *Client) GetChildren(path string) ([]string, error)

func (*Client) GetChildrenW

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

func (*Client) GetMinZkPath added in v0.3.2

func (c *Client) GetMinZkPath(baseZkPath, prefix string) ([]string, string, error)

func (*Client) Lock added in v0.3.2

func (c *Client) Lock(basePath string) error

func (*Client) RegisterSeq added in v0.3.2

func (c *Client) RegisterSeq(path string, data []byte) (string, error)

func (*Client) RegisterTemp

func (c *Client) RegisterTemp(path string, data []byte) (string, error)

func (*Client) RegisterTempSeq

func (c *Client) RegisterTempSeq(path string, data []byte) (string, error)

func (*Client) Resign added in v0.3.2

func (c *Client) Resign(basePath string) error

func (*Client) StateToString

func (c *Client) StateToString(state zk.State) string

func (*Client) Unlock added in v0.3.2

func (c *Client) Unlock(basePath string) error

func (*Client) ZkConn

func (c *Client) ZkConn() *zk.Conn

Jump to

Keyboard shortcuts

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