Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(servers []string, timeout time.Duration) (*client, error)
- func ContextGetTimeout(ctx context.Context) time.Duration
- func ContextPutTimeout(ctx context.Context, t time.Duration) context.Context
- func Hosts() []string
- func NewService(ctx context.Context, url url.URL, close Dispose) (Registry, error)
- func SanitizeUrl(url url.URL) url.URL
- type Event
- type Node
- func (this *Node) Basename() string
- func (this *Node) CheckAndIncrement(current, increment int) (int, error)
- func (this *Node) Children() ([]*Node, error)
- func (this *Node) CountChildren() int32
- func (this *Node) Delete() error
- func (this *Node) FilterSubtreeNodes(filter func(*Node) bool) ([]*Node, error)
- func (this *Node) Id() url.URL
- func (this *Node) Increment(increment int) (int, error)
- func (this *Node) Load() error
- func (this *Node) Set(value []byte) error
- func (this *Node) SubtreeNodes() ([]*Node, error)
- func (this *Node) SubtreePaths() ([]string, error)
- func (this *Node) ValueString() string
- func (this *Node) Version() int32
- func (this *Node) VisitSubtreeNodes(accept func(*Node) bool) ([]*Node, error)
- func (this *Node) WatchOnce(f func(Event)) (chan<- bool, error)
- func (this *Node) WatchOnceChildren(f func(Event)) (chan<- bool, error)
- type Service
Constants ¶
View Source
const ( StateUnknown = zk.StateUnknown StateDisconnected = zk.StateDisconnected StateConnecting = zk.StateConnecting StateAuthFailed = zk.StateAuthFailed StateConnectedReadOnly = zk.StateConnectedReadOnly StateSaslAuthenticated = zk.StateSaslAuthenticated StateExpired = zk.StateExpired StateConnected = zk.StateConnected StateHasSession = zk.StateHasSession EventNodeCreated = zk.EventNodeCreated EventNodeDataChanged = zk.EventNodeDataChanged EventNodeDeleted = zk.EventNodeDeleted EventNodeChildrenChanged = zk.EventNodeChildrenChanged // Default Zk timeout DefaultTimeout = 1 * time.Hour // Defaults to localhost at port 2181. DefaultZkHosts = "localhost:2181" // Environment variable to use when hosts are not specified explicitly. EnvZkHosts = "ZK_HOSTS" )
View Source
const (
TimeoutContextKey timeoutContextKey = 1
)
Variables ¶
View Source
var ( ErrNotConnected = errors.New("zk-not-initialized") ErrConflict = errors.New("error-conflict") ErrNotExist = zk.ErrNoNode ErrConnectionClosed = zk.ErrConnectionClosed ErrUnknown = zk.ErrUnknown ErrAPIError = zk.ErrAPIError ErrNoAuth = zk.ErrNoAuth ErrBadVersion = zk.ErrBadVersion ErrNoChildrenForEphemerals = zk.ErrNoChildrenForEphemerals ErrNodeExists = zk.ErrNodeExists ErrNotEmpty = zk.ErrNotEmpty ErrSessionExpired = zk.ErrSessionExpired ErrInvalidACL = zk.ErrInvalidACL ErrAuthFailed = zk.ErrAuthFailed ErrClosing = zk.ErrClosing ErrNothing = zk.ErrNothing ErrSessionMoved = zk.ErrSessionMoved )
Functions ¶
func ContextPutTimeout ¶
func Hosts ¶
func Hosts() []string
Determines the zookeeper hosts from ENV variables or use the default
func NewService ¶
Optional parameter is timeout, in Duration.
Types ¶
type Node ¶
type Node struct { Path string Value []byte Members []string Stats *zk.Stat Leaf bool // contains filtered or unexported fields }
func (*Node) CheckAndIncrement ¶
func (*Node) CountChildren ¶
func (*Node) FilterSubtreeNodes ¶
Recursively go through all the children. Apply filter for each node. If filter returns true for the particular node, this node (though not necessarily all its children) will be excluded. This is useful for searching through all true by name or by whether it's a parent node or not.
func (*Node) SubtreeNodes ¶
func (*Node) SubtreePaths ¶
func (*Node) ValueString ¶
func (*Node) VisitSubtreeNodes ¶
type Service ¶
type Service interface { io.Closer Reconnect() error Events() <-chan Event CreateNode(string, []byte, bool) (*Node, error) PutNode(string, []byte, bool) (*Node, error) GetNode(string) (*Node, error) DeleteNode(string) error WatchOnce(string, func(Event)) (chan<- bool, error) WatchOnceChildren(string, func(Event)) (chan<- bool, error) Watch(string, func(Event) bool, ...func(error)) (chan<- bool, error) WatchChildren(string, func(Event) bool, ...func(error)) (chan<- bool, error) }
Click to show internal directories.
Click to hide internal directories.