Documentation ¶
Index ¶
- Constants
- Variables
- func ReadPacket(zk net.Conn, r interface{}) (string, error)
- func Serve(ctx context.Context, ln net.Listener, auth AuthFunc, zk ZKFunc)
- func ServeSerial(ctx context.Context, ln net.Listener, auth AuthFunc, zk ZKFunc)
- func WritePacket(zk net.Conn, r interface{}) error
- type ACL
- type AuthConn
- type AuthFunc
- type AuthRequest
- type AuthResponse
- type CheckVersionRequest
- type Client
- type CloseRequest
- type CloseResponse
- type Conn
- type ConnectRequest
- type ConnectResponse
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type DeleteResponse
- type ErrCode
- type EventType
- type ExistsRequest
- type ExistsResponse
- type GetAclRequest
- type GetAclResponse
- type GetChildren2Request
- type GetChildren2Response
- type GetChildrenRequest
- type GetChildrenResponse
- type GetDataRequest
- type GetDataResponse
- type MultiHeader
- type MultiRequest
- type MultiRequestOp
- type MultiResponse
- type MultiResponseOp
- type Op
- type PingRequest
- type PingResponse
- type ResponseHeader
- type Session
- type SessionPool
- type SetAclRequest
- type SetAclResponse
- type SetAuthRequest
- type SetAuthResponse
- type SetDataRequest
- type SetDataResponse
- type SetWatchesRequest
- type SetWatchesResponse
- type Sid
- type Stat
- type State
- type SyncRequest
- type SyncResponse
- type Ver
- type WatchHandler
- type WatcherEvent
- type Watches
- type Xid
- type ZK
- type ZKFunc
- type ZKRequest
- type ZKResponse
- type ZXid
Constants ¶
View Source
const ( FlagEphemeral = 1 FlagSequence = 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 (
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") ErrBadArguments = errors.New("zk: bad arguments") )
View Source
var ( ErrShortBuffer = errors.New("short buffer") ErrPtrExpected = errors.New("ptr expected") ErrUnhandledFieldType = errors.New("unhandled field type") )
View Source
var PerfectZXidMode bool = true
PerfectZXid is enabled to insert err writes to match zookeeper's zxids
Functions ¶
func ServeSerial ¶
ServeSerial has at most one inflight request at a time so two servers can be reliably cross checked.
func WritePacket ¶
Types ¶
type AuthConn ¶
type AuthConn interface { Read() (*AuthRequest, error) Write(AuthResponse) (Conn, error) Close() }
AuthConn transfers zookeeper handshaking for establishing a session
func NewAuthConn ¶
type AuthRequest ¶
type AuthRequest struct { Req *ConnectRequest FourLetterWord string }
type AuthResponse ¶
type AuthResponse struct { Resp *ConnectResponse FourLetterWord string }
type CheckVersionRequest ¶
type CheckVersionRequest pathVersionRequest
type Client ¶
type Client interface { Send(xid Xid, req interface{}) error Read() <-chan ZKResponse StopNotify() <-chan struct{} Close() }
type CloseRequest ¶
type CloseRequest struct{}
type CloseResponse ¶
type CloseResponse struct{}
type Conn ¶
type ConnectRequest ¶
type ConnectResponse ¶
type CreateResponse ¶
type CreateResponse pathResponse
type DeleteRequest ¶
type DeleteRequest pathVersionRequest
type DeleteResponse ¶
type DeleteResponse struct{}
type ExistsRequest ¶
type ExistsRequest pathWatchRequest
type ExistsResponse ¶
type ExistsResponse statResponse
type GetAclRequest ¶
type GetAclRequest pathRequest
type GetAclResponse ¶
type GetChildren2Request ¶
type GetChildren2Request pathWatchRequest
type GetChildren2Response ¶
type GetChildrenRequest ¶
type GetChildrenRequest pathWatchRequest
type GetChildrenResponse ¶
type GetChildrenResponse struct {
Children []string
}
type GetDataRequest ¶
type GetDataRequest pathWatchRequest
type GetDataResponse ¶
type MultiHeader ¶
type MultiRequest ¶
type MultiRequest struct { Ops []MultiRequestOp DoneHeader MultiHeader }
type MultiRequestOp ¶
type MultiRequestOp struct { Header MultiHeader Op interface{} }
type MultiResponse ¶
type MultiResponse struct { Ops []MultiResponseOp DoneHeader MultiHeader }
type MultiResponseOp ¶
type MultiResponseOp struct { Header MultiHeader String string Stat *Stat }
type PingRequest ¶
type PingRequest struct{}
type PingResponse ¶
type PingResponse struct{}
type ResponseHeader ¶
type Session ¶
type Session interface { Conn Watches Sid() Sid ZXid() ZXid ConnReq() ConnectRequest Backing() interface{} }
type SessionPool ¶
type SessionPool struct {
// contains filtered or unexported fields
}
func NewSessionPool ¶
func NewSessionPool(client *etcd.Client) *SessionPool
type SetAclRequest ¶
type SetAclResponse ¶
type SetAclResponse statResponse
type SetAuthRequest ¶
type SetAuthRequest auth
type SetAuthResponse ¶
type SetAuthResponse struct{}
type SetDataRequest ¶
type SetDataResponse ¶
type SetDataResponse statResponse
type SetWatchesRequest ¶
type SetWatchesResponse ¶
type SetWatchesResponse struct{}
type Stat ¶
type Stat struct { // Czxid is the zxid change that caused this znode to be created. Czxid ZXid // Mzxid is The zxid change that last modified this znode. Mzxid ZXid // Ctime is milliseconds from epoch when this znode was created. Ctime int64 // Mtime is The time in milliseconds from epoch when this znode was last modified. Mtime int64 Version Ver // The number of changes to the data of this znode. Cversion Ver // The number of changes to the children of this znode. Aversion Ver // The number of changes to the ACL of this znode. EphemeralOwner Sid // 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 ZXid // last modified children }
type SyncRequest ¶
type SyncRequest pathRequest
type SyncResponse ¶
type SyncResponse pathResponse
type WatchHandler ¶ added in v0.0.3
type WatcherEvent ¶
type ZK ¶
type ZK interface { Create(xid Xid, op *CreateRequest) ZKResponse Delete(xid Xid, op *DeleteRequest) ZKResponse Exists(xid Xid, op *ExistsRequest) ZKResponse GetData(xid Xid, op *GetDataRequest) ZKResponse SetData(xid Xid, op *SetDataRequest) ZKResponse GetAcl(xid Xid, op *GetAclRequest) ZKResponse SetAcl(xid Xid, op *SetAclRequest) ZKResponse GetChildren(xid Xid, op *GetChildrenRequest) ZKResponse Sync(xid Xid, op *SyncRequest) ZKResponse Ping(xid Xid, op *PingRequest) ZKResponse GetChildren2(xid Xid, op *GetChildren2Request) ZKResponse // opCheck = 13 Multi(xid Xid, op *MultiRequest) ZKResponse Close(xid Xid, op *CloseRequest) ZKResponse SetAuth(xid Xid, op *SetAuthRequest) ZKResponse SetWatches(xid Xid, op *SetWatchesRequest) ZKResponse }
ZK is a synchronous interface
type ZKResponse ¶
type ZKResponse struct { Hdr *ResponseHeader Resp interface{} // Err is from transmission errors, etc Err error }
func DispatchZK ¶
func DispatchZK(zk ZK, xid Xid, op interface{}) ZKResponse
Source Files ¶
Click to show internal directories.
Click to hide internal directories.