zookeeper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ZkConnPoolMu  sync.Mutex
	ZkConnPool    = make(map[string]*ZkConn, 1)
	ErrInvalidSev = errors.New("invalid conncet addr info")
	ErrorConn     = errors.New("can't connect to remote servers")
)

Functions

This section is empty.

Types

type ConfigMessage

type ConfigMessage struct {
	RegionId   int        `json:"region_id"`
	ZkNodePath string     `json:"zk_node_path"`
	ZkConfig   []ZkConfig `json:"zk_config"`
}

type MongoConfig

type MongoConfig struct {
	Url    string `json:"uri"`
	RsName string `json:"rs_name"`
}

type NodeConfig

type NodeConfig struct {
	MongoDB       map[string]string `json:"mongo_db"`
	NetListenAddr string            `json:"net_listen_addr"`
	NetListenPort uint32            `json:"net_listen_port"`
	RegionId      uint32            `json:"region_id"`

	ZkConfig   []ZkConfig `json:"zk_config"`
	ZkNodePath string     `json:"zk_node_path"`
}

type ZkConfig

type ZkConfig struct {
	Region     interface{}       `json:"region"`
	Names      map[string]string `json:"names"`
	Connstring string            `json:"connstring"`
}

type ZkConn

type ZkConn struct {
	Addr string
	// contains filtered or unexported fields
}

func GetZkInstance

func GetZkInstance(zkCluster string) (*ZkConn, error)

Get the instance information of the zk cluster connection

func NewZkConn

func NewZkConn(addr string) (*ZkConn, error)

Initialize zk link

func (*ZkConn) CreateNewNode

func (c *ZkConn) CreateNewNode(path string, data []byte) (string,
	error)

create new link node

func (*ZkConn) DeleteNode

func (c *ZkConn) DeleteNode(path string) error

func (*ZkConn) GetChildrenWatcher

func (c *ZkConn) GetChildrenWatcher(path string) ([]string, *zk.Stat,
	<-chan zk.Event, error)

get the change watcher of all child nodes of the current node

func (*ZkConn) GetNode

func (c *ZkConn) GetNode(path string) ([]byte, error)

func (*ZkConn) GetNodeWatcher

func (c *ZkConn) GetNodeWatcher(path string) ([]byte, *zk.Stat,
	<-chan zk.Event, error)

get the watcher of current node (the full path info)

func (*ZkConn) ListChildren

func (c *ZkConn) ListChildren(path string) ([]string, error)

list child path info

func (*ZkConn) NodeExists

func (c *ZkConn) NodeExists(path string) (bool, *zk.Stat,
	error)

if node exist

func (*ZkConn) SetNode

func (c *ZkConn) SetNode(path string, data []byte) error

set node info

Jump to

Keyboard shortcuts

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