Versions in this module Expand all Collapse all v1 v1.0.1 Feb 6, 2021 Changes in this version + const DefaultLeaderElectionPort + const DefaultPeerPort + const DefaultPort + const DefaultServerAutoPurgeSnapRetainCount + const DefaultServerInitLimit + const DefaultServerSyncLimit + const DefaultServerTickTime + const DynConfPath + const FlagEphemeral + const FlagSequence + const PermAdmin + const PermAll + const PermCreate + const PermDelete + const PermRead + const PermWrite + const TypeObserver + const TypeParticipant + var ErrAPIError = errors.New("zk: api error") + var ErrAuthFailed = errors.New("zk: client authentication failed") + var ErrBadArguments = errors.New("invalid arguments") + var ErrBadVersion = errors.New("zk: version conflict") + var ErrClosing = errors.New("zk: zookeeper is closing") + var ErrConnectionClosed = errors.New("zk: connection closed") + var ErrDeadlock = errors.New("zk: trying to acquire a lock twice") + var ErrEphemeralOnLocalSession = errors.New("zk: ephemeral on local session") + var ErrInvalidACL = errors.New("zk: invalid ACL specified") + var ErrInvalidPath = errors.New("zk: invalid path") + var ErrNoAuth = errors.New("zk: not authenticated") + var ErrNoChildrenForEphemerals = errors.New("zk: ephemeral nodes may not have children") + var ErrNoNode = errors.New("zk: node does not exist") + var ErrNoServer = errors.New("zk: could not connect to a server") + var ErrNoWatcher = errors.New("zk: no such watcher") + var ErrNodeExists = errors.New("zk: node already exists") + var ErrNotEmpty = errors.New("zk: node has children") + var ErrNotLocked = errors.New("zk: not locked") + var ErrNotReadOnly = errors.New("zk: write operation on read-only session") + var ErrNothing = errors.New("zk: no server responses to process") + var ErrPtrExpected = errors.New("zk: encode/decode expect a non-nil pointer to struct") + var ErrReconfigDisabled = errors.New(...) + var ErrSessionExpired = errors.New("zk: session has been expired by the server") + var ErrSessionMoved = errors.New("zk: session moved to another server, so operation is ignored") + var ErrShortBuffer = errors.New("zk: buffer too small") + var ErrUnhandledFieldType = errors.New("zk: unhandled field type") + var ErrUnimplemented = errors.New("zk: unimplemented") + var ErrUnknown = errors.New("zk: unknown error") + func AllowReadOnly(b bool) connOption + func CloseOnSessionExpiration(b bool) connOption + func FLWRuok(servers []string, timeout time.Duration) []bool + func FormatServers(servers []string) []string + func WithDialer(dialer Dialer) connOption + func WithDynamicReconfig() connOption + func WithEventCallback(cb EventCallback) connOption + func WithHostProvider(hostProvider HostProvider) connOption + func WithLogInfo(logInfo bool) connOption + func WithLogger(logger Logger) connOption + func WithMaxBufferSize(maxBufferSize int) connOption + func WithMaxConnBufferSize(maxBufferSize int) connOption + type ACL struct + ID string + Perms int32 + Scheme string + func AuthACL(perms int32) []ACL + func DigestACL(perms int32, user, password string) []ACL + func WorldACL(perms int32) []ACL + type CheckVersionRequest PathVersionRequest + type Conn struct + func Connect(servers []string, sessionTimeout time.Duration, options ...connOption) (*Conn, <-chan Event, error) + func ConnectWithDialer(servers []string, sessionTimeout time.Duration, dialer Dialer) (*Conn, <-chan Event, error) + func (c *Conn) AddAuth(scheme string, auth []byte) error + func (c *Conn) Children(path string) ([]string, *Stat, error) + func (c *Conn) ChildrenW(path string) ([]string, *Stat, <-chan Event, error) + func (c *Conn) Close() + func (c *Conn) Create(path string, data []byte, flags int32, acl []ACL) (string, error) + func (c *Conn) Create2(path string, data []byte, flags int32, acl []ACL) (string, *Stat, error) + func (c *Conn) CreateProtectedEphemeralSequential(path string, data []byte, acl []ACL) (string, error) + func (c *Conn) Delete(path string, version int32) error + func (c *Conn) Exists(path string) (bool, *Stat, error) + func (c *Conn) ExistsW(path string) (bool, *Stat, <-chan Event, error) + func (c *Conn) Get(path string) ([]byte, *Stat, error) + func (c *Conn) GetACL(path string) ([]ACL, *Stat, error) + func (c *Conn) GetW(path string) ([]byte, *Stat, <-chan Event, error) + func (c *Conn) IncrementalReconfig(joining, leaving []string, version int64) (*Stat, error) + func (c *Conn) Multi(ops ...interface{}) ([]MultiResponse, error) + func (c *Conn) Reconfig(members []string, version int64) (*Stat, error) + func (c *Conn) Server() string + func (c *Conn) SessionID() int64 + func (c *Conn) Set(path string, data []byte, version int32) (*Stat, error) + func (c *Conn) SetACL(path string, acl []ACL, version int32) (*Stat, error) + func (c *Conn) SetLogger(l Logger) + func (c *Conn) State() State + func (c *Conn) Sync(path string) (string, error) + type CreateRequest struct + Acl []ACL + Data []byte + Flags int32 + Path string + type DNSHostProvider struct + func (hp *DNSHostProvider) Connected() + func (hp *DNSHostProvider) Init(servers []string) error + func (hp *DNSHostProvider) Len() int + func (hp *DNSHostProvider) Next() (server string, retryStart bool) + type DeleteRequest PathVersionRequest + type Dialer func(network, address string, timeout time.Duration) (net.Conn, error) + type DynConf struct + Servers []ZkServer + Version int64 + func ParseDynConfig(data []byte) (*DynConf, error) + func (cfg *DynConf) ClientAddrs() []string + type ErrCode int32 + type ErrMissingServerConfigField string + func (e ErrMissingServerConfigField) Error() string + type Event struct + Err error + Path string + Server string + State State + Type EventType + type EventCallback func(Event) + type EventType int32 + const EventNodeChildrenChanged + const EventNodeCreated + const EventNodeDataChanged + const EventNodeDeleted + const EventNotWatching + const EventSession + func (t EventType) String() string + type HostProvider interface + Connected func() + Init func(servers []string) error + Len func() int + Next func() (server string, retryStart bool) + type Lock struct + func NewLock(c *Conn, path string, acl []ACL) *Lock + func (l *Lock) Lock() error + func (l *Lock) Unlock() error + type Logger interface + Printf func(string, ...interface{}) + var DefaultLogger Logger = defaultLogger{} + type Mode uint8 + const ModeFollower + const ModeLeader + const ModeStandalone + const ModeUnknown + func (m Mode) String() string + type MultiResponse struct + Error error + Stat *Stat + String string + type PathVersionRequest struct + Path string + Version int32 + type ServerClient struct + Addr string + AvgLatency int32 + Error error + Established time.Time + LastLatency int32 + LastOperation string + LastResponse time.Time + Lcxid int64 + Lzxid int64 + MaxLatency int32 + MinLatency int32 + Queued int64 + Received int64 + Sent int64 + SessionID int64 + Timeout int32 + type ServerClients struct + Clients []*ServerClient + Error error + func FLWCons(servers []string, timeout time.Duration) ([]*ServerClients, bool) + type ServerConfig struct + AutoPurgePurgeInterval int + AutoPurgeSnapRetainCount int + ClientPort int + DataDir string + InitLimit int + Servers []ServerConfigServer + SyncLimit int + TickTime int + func (sc ServerConfig) Marshall(w io.Writer) error + type ServerConfigServer struct + Host string + ID int + LeaderElectionPort int + PeerPort int + type ServerStats struct + AvgLatency int64 + BuildTime time.Time + Connections int64 + Counter int32 + Epoch int32 + Error error + MaxLatency int64 + MinLatency int64 + Mode Mode + NodeCount int64 + Outstanding int64 + Received int64 + Sent int64 + Version string + func FLWSrvr(servers []string, timeout time.Duration) ([]*ServerStats, bool) + type SetDataRequest struct + Data []byte + Path string + Version int32 + type SimpleDNSHostProvider struct + func (hp *SimpleDNSHostProvider) Connected() + func (hp *SimpleDNSHostProvider) Init(servers []string) error + func (hp *SimpleDNSHostProvider) Len() int + func (hp *SimpleDNSHostProvider) Next() (server string, retryStart bool) + type Stat struct + Aversion int32 + Ctime int64 + Cversion int32 + Czxid int64 + DataLength int32 + EphemeralOwner int64 + Mtime int64 + Mzxid int64 + NumChildren int32 + Pzxid int64 + Version int32 + type State int32 + const StateAuthFailed + const StateConnected + const StateConnectedReadOnly + const StateConnecting + const StateDisconnected + const StateExpired + const StateHasSession + const StateSaslAuthenticated + const StateSyncConnected + const StateUnknown + func (s State) IsConnected() bool + func (s State) String() string + type ZkServer struct + ClientHost string + ClientPort int + Type ZkServerType + type ZkServerType string