zk

package
v0.0.0-...-1f713e5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ZkPaths map[string]string = map[string]string{
	"pools": "/pools",
	"rules": "/rules",
	"tries": "/tries",
	"ports": "/ports",
}

Functions

func AddHosts

func AddHosts(zk *zookeeper.Conn, pool string, hosts map[string]config.Host) error

func ArrayDiff

func ArrayDiff(curr, prev []string) []string

func DelHosts

func DelHosts(zk *zookeeper.Conn, pool string, hosts []string) error

func DelPool

func DelPool(zk *zookeeper.Conn, name string) error

func DelPort

func DelPort(zk *zookeeper.Conn, port uint16) error

func DelRule

func DelRule(zk *zookeeper.Conn, name string) error

func DelTrie

func DelTrie(zk *zookeeper.Conn, name string) error

func GetHosts

func GetHosts(zk *zookeeper.Conn, pool string) (map[string]config.Host, error)

func GetPool

func GetPool(zk *zookeeper.Conn, name string) (config.Pool, error)

func GetPort

func GetPort(zk *zookeeper.Conn, portUint uint16) (port config.Port, err error)

func GetRule

func GetRule(zk *zookeeper.Conn, name string) (rule config.Rule, err error)

func GetTrie

func GetTrie(zk *zookeeper.Conn, name string) (trie config.Trie, err error)

func ListPools

func ListPools(zk *zookeeper.Conn) ([]string, error)

func ListPorts

func ListPorts(zk *zookeeper.Conn) ([]uint16, error)

func ListRules

func ListRules(zk *zookeeper.Conn) ([]string, error)

func ListTries

func ListTries(zk *zookeeper.Conn) ([]string, error)

func PoolExists

func PoolExists(zk *zookeeper.Conn, name string) (bool, error)

func PortExists

func PortExists(zk *zookeeper.Conn, port uint16) (bool, error)

func RuleExists

func RuleExists(zk *zookeeper.Conn, name string) (bool, error)

func SetPool

func SetPool(zk *zookeeper.Conn, pool config.Pool) error

func SetPort

func SetPort(zk *zookeeper.Conn, port config.Port) error

func SetRule

func SetRule(zk *zookeeper.Conn, rule config.Rule) error

func SetTrie

func SetTrie(zk *zookeeper.Conn, trie config.Trie) error

func SetZkRoot

func SetZkRoot(root string)

func TrieExists

func TrieExists(zk *zookeeper.Conn, name string) (bool, error)

Types

type EventCallbacks

type EventCallbacks interface {
	Created(path, json string)
	Deleted(path string)
	Changed(path, json string)
}

type ZkConn

type ZkConn struct {
	sync.Mutex
	ResetCh chan bool

	Conn *zookeeper.Conn
	// contains filtered or unexported fields
}

func ManagedZkConn

func ManagedZkConn(servers string) *ZkConn

func (*ZkConn) IsConnected

func (z *ZkConn) IsConnected() bool

func (*ZkConn) ManageNode

func (z *ZkConn) ManageNode(node string, callbacks EventCallbacks) error

func (*ZkConn) ManageTree

func (z *ZkConn) ManageTree(node string, callbacks ...EventCallbacks)

func (*ZkConn) Shutdown

func (z *ZkConn) Shutdown()

type ZkPool

type ZkPool struct {
	Name     string
	Internal bool
	Config   config.PoolConfig
}

func ToZkPool

func ToZkPool(p config.Pool) (ZkPool, map[string]config.Host)

func (ZkPool) Pool

func (z ZkPool) Pool(hosts map[string]config.Host) config.Pool

Jump to

Keyboard shortcuts

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