Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultOption() *option
- func WarpperTimeout(f func(), timeout time.Duration) error
- func WithConnectNum(num int) func(*option)
- func WithConnectTimeout(timeout time.Duration) func(*option)
- func WithExecTimeout(timeout time.Duration) func(*option)
- type HandlerChildren
- type HandlerValue
- type Option
- type ZkClient
- func (zc *ZkClient) CreatePersistentNode(path string, data string) (err error)
- func (zc *ZkClient) CreatePersistentSeqNode(path string, data string) (rpath string, err error)
- func (zc *ZkClient) CreateTempNode(path string, data string) (err error)
- func (zc *ZkClient) CreateTempSeqNode(path string, data string) (rpath string, err error)
- func (zc *ZkClient) Delete(path string) (err error)
- func (zc *ZkClient) GetChildren(path string) (children []string, version int32, err error)
- func (zc *ZkClient) GetValue(path string) (data string, version int32, err error)
- func (zc *ZkClient) IsExists(path string) (b bool, err error)
- func (zc *ZkClient) Update(path string, data string) (err error)
- func (zc *ZkClient) WatchChildren(path string, handler HandlerChildren) error
- func (zc *ZkClient) WatchValue(path string, handler HandlerValue) error
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 ¶
WarpperTimeout exec function with timeout
func WithConnectTimeout ¶
WithConnectTimeout set connect timeout
func WithExecTimeout ¶
WithExecTimeout set exec timeout
Types ¶
type HandlerChildren ¶
HandlerChildren handler watch children event
type HandlerValue ¶
HandlerValue handler watch value event
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 ¶
CreatePersistentNode create persistent node with data
func (*ZkClient) CreatePersistentSeqNode ¶
CreatePersistentSeqNode create persistent seq node
func (*ZkClient) CreateTempNode ¶
CreateTempNode create temp node
func (*ZkClient) CreateTempSeqNode ¶
CreateTempSeqNode create temp seq node
func (*ZkClient) GetChildren ¶
GetChildren get children path
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
Click to show internal directories.
Click to hide internal directories.