Documentation ¶
Index ¶
- Constants
- Variables
- func StartTracer(listenAddr, serverAddr string)
- type ACL
- type CheckVersionRequest
- type Conn
- 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 CreateType, acl []ACL) (string, 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) Multi(ops MultiOps) error
- 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) State() State
- func (c *Conn) Sync(path string) (string, error)
- type CreateRequest
- type CreateType
- type DeleteRequest
- type Dialer
- type ErrCode
- type Event
- type EventType
- type Lock
- type MultiOps
- type PathVersionRequest
- type SetDataRequest
- type Stat
- type State
Constants ¶
View Source
const ( EventNodeCreated = EventType(1) EventNodeDeleted = EventType(2) EventNodeDataChanged = EventType(3) EventNodeChildrenChanged = EventType(4) EventSession = EventType(-1) EventNotWatching = EventType(-2) )
View Source
const ( StateUnknown = State(-1) StateDisconnected = State(0) StateConnecting = State(1) StateSyncConnected = State(3) StateAuthFailed = State(4) StateConnectedReadOnly = State(5) StateSaslAuthenticated = State(6) StateExpired = State(-112) StateConnected = State(100) StateHasSession = State(101) )
View Source
const ( PermRead = 1 << iota PermWrite PermCreate PermDelete PermAdmin PermAll = 0x1f )
Constants for ACL permissions
View Source
const (
DefaultPort = 2181
)
Variables ¶
View Source
var ( ErrConnectionClosed = errors.New("zk: connection closed") ErrUnknown = errors.New("zk: unknown error") ErrAPIError = errors.New("zk: api error") ErrNoNode = errors.New("zk: node does not exist") ErrNoAuth = errors.New("zk: not authenticated") ErrBadVersion = errors.New("zk: version conflict") ErrNoChildrenForEphemerals = errors.New("zk: ephemeral nodes may not have children") ErrNodeExists = errors.New("zk: node already exists") ErrNotEmpty = errors.New("zk: node has children") ErrSessionExpired = errors.New("zk: session has been expired by the server") ErrInvalidACL = errors.New("zk: invalid ACL specified") ErrAuthFailed = errors.New("zk: client authentication failed") ErrClosing = errors.New("zk: zookeeper is closing") ErrNothing = errors.New("zk: no server responsees to process") ErrSessionMoved = errors.New("zk: session moved to another server, so operation is ignored") )
View Source
var ( ErrDeadlock = errors.New("zk: trying to acquire a lock twice") ErrNotLocked = errors.New("zk: not locked") )
View Source
var ( ErrUnhandledFieldType = errors.New("zk: unhandled field type") ErrPtrExpected = errors.New("zk: encode/decode expect a non-nil pointer to struct") ErrShortBuffer = errors.New("zk: buffer too small") )
View Source
var ErrNoServer = errors.New("zk: could not connect to a server")
Functions ¶
func StartTracer ¶
func StartTracer(listenAddr, serverAddr string)
Types ¶
type ACL ¶
type CheckVersionRequest ¶
type CheckVersionRequest PathVersionRequest
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func ConnectWithDialer ¶
func (*Conn) CreateProtectedEphemeralSequential ¶
func (c *Conn) CreateProtectedEphemeralSequential(path string, data []byte, acl []ACL) (string, error)
CreateProtectedEphemeralSequential fixes a race condition if the server crashes after it creates the node. On reconnect the session may still be valid so the ephemeral node still exists. Therefore, on reconnect we need to check if a node with a GUID generated on create exists.
type CreateType ¶
type CreateType int32
const ( CreatePersistent CreateType = 0 // Node remains after session expires CreateEphemeral CreateType = 1 // Node deletes when the creator session expires CreateSequence CreateType = 2 // Sequence number is appended to the node path )
func (CreateType) String ¶
func (c CreateType) String() string
type DeleteRequest ¶
type DeleteRequest PathVersionRequest
type MultiOps ¶
type MultiOps struct { Create []CreateRequest Delete []DeleteRequest SetData []SetDataRequest Check []CheckVersionRequest }
type PathVersionRequest ¶
type SetDataRequest ¶
type Stat ¶
type Stat struct { Czxid int64 // The zxid of the change that caused this znode to be created. Mzxid int64 // The zxid of the change that last modified this znode. Ctime int64 // The time in milliseconds from epoch when this znode was created. Mtime int64 // The time in milliseconds from epoch when this znode was last modified. Version int32 // The number of changes to the data of this znode. Cversion int32 // The number of changes to the children of this znode. Aversion int32 // The number of changes to the ACL of this znode. EphemeralOwner int64 // The session id of the owner of this znode if the znode is an ephemeral node. If it is not an ephemeral node, it will be zero. DataLength int32 // The length of the data field of this znode. NumChildren int32 // The number of children of this znode. Pzxid int64 // last modified children }
Click to show internal directories.
Click to hide internal directories.