Documentation ¶
Index ¶
- Variables
- type Builder
- func (b *Builder) AppendPathPrefix(childPath string) *Builder
- func (b *Builder) Build() (*ZkPlus, error)
- func (b *Builder) BuildDirect() (*ZkPlus, <-chan zk.Event, error)
- func (b *Builder) Connector(zkConnector ZkConnector) *Builder
- func (b *Builder) DialZkConnector(servers []string, sessionTimeout time.Duration, dialer zk.Dialer) *Builder
- func (b *Builder) Logger(logger log.Logger) *Builder
- func (b *Builder) PathPrefix(pathPrefix string) *Builder
- func (b *Builder) ZkPlus(zkPlus *ZkPlus) *Builder
- type StaticConnector
- type ZkConnector
- type ZkConnectorFunc
- type ZkPlus
- func (z *ZkPlus) Children(path string) ([]string, *zk.Stat, error)
- func (z *ZkPlus) ChildrenW(path string) ([]string, *zk.Stat, <-chan zk.Event, error)
- func (z *ZkPlus) Close()
- func (z *ZkPlus) Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error)
- func (z *ZkPlus) Delete(path string, version int32) error
- func (z *ZkPlus) EventChan() <-chan zk.Event
- func (z *ZkPlus) Exists(path string) (bool, *zk.Stat, error)
- func (z *ZkPlus) ExistsW(path string) (bool, *zk.Stat, <-chan zk.Event, error)
- func (z *ZkPlus) Get(path string) ([]byte, *zk.Stat, error)
- func (z *ZkPlus) GetW(path string) ([]byte, *zk.Stat, <-chan zk.Event, error)
- func (z *ZkPlus) Set(path string, data []byte, version int32) (*zk.Stat, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = log.Logger(log.DefaultLogger.CreateChild())
DefaultLogger is used by zkplus when no logger is set for the struct
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder helps users build a ZkPlus connection
func NewBuilder ¶
func NewBuilder() *Builder
NewBuilder creates a new builder for making ZkPlus connections
func (*Builder) AppendPathPrefix ¶
AppendPathPrefix to the existing path. Can be chained to create /a/b/c directories
func (*Builder) Build ¶
Build a ZkPlus connection, returning an error if the path doesn't make sense
func (*Builder) BuildDirect ¶
BuildDirect is a helper that looks like the regular zk create function
func (*Builder) Connector ¶
func (b *Builder) Connector(zkConnector ZkConnector) *Builder
Connector sets what we use to create zk connections
func (*Builder) DialZkConnector ¶
func (b *Builder) DialZkConnector(servers []string, sessionTimeout time.Duration, dialer zk.Dialer) *Builder
DialZkConnector sets how zk network connections are created
func (*Builder) PathPrefix ¶
PathPrefix is the prefix any zk operations get
type StaticConnector ¶
type StaticConnector struct { C zktest.ZkConnSupported Ch <-chan zk.Event }
A StaticConnector will always return the same connection and chan for every connection request. Usually only needed for testing
func (*StaticConnector) Conn ¶
func (s *StaticConnector) Conn() (zktest.ZkConnSupported, <-chan zk.Event, error)
Conn will just return the constructed connection and event channel
type ZkConnector ¶
type ZkConnector interface {
Conn() (zktest.ZkConnSupported, <-chan zk.Event, error)
}
ZkConnector tells ZkPlus how to create a zk connection
type ZkConnectorFunc ¶
type ZkConnectorFunc func() (zktest.ZkConnSupported, <-chan zk.Event, error)
ZkConnectorFunc is a helper to wrap a simple function for making Zk connections
func (ZkConnectorFunc) Conn ¶
func (f ZkConnectorFunc) Conn() (zktest.ZkConnSupported, <-chan zk.Event, error)
Conn to a Zk Connection, calling itself to create the connection
type ZkPlus ¶
type ZkPlus struct {
// contains filtered or unexported fields
}
ZkPlus wraps a zookeeper connection to provide namespacing, auto reconnects, and server list changing
func (*ZkPlus) Close ¶
func (z *ZkPlus) Close()
Close this zk connection, blocking till the eventLoop() is finished.
func (*ZkPlus) EventChan ¶
EventChan that will see zookeeper events whose path is changed to this zk connection's namespace
func (*ZkPlus) ExistsW ¶
ExistsW is like Exists but also sets a watch. Note: We DO NOT change paths on the returned channel nor do we reconnect it. Use the global channel instead