Documentation ¶
Overview ¶
Package zk provides functions for getting and putting data in a znode.
Index ¶
- Constants
- Variables
- type ACL
- type Client
- func (c *Client) Children(path string) ([]string, error)
- func (c *Client) Close() error
- func (c *Client) Create(path string, value []byte, acls []ACL) error
- func (c *Client) CreateAll(path string, value []byte, acls []ACL) error
- func (c *Client) CreateEphemeral(path string, value []byte, acls []ACL) error
- func (c *Client) CreateEphemeralSequential(path string, value []byte, acls []ACL) (string, error)
- func (c *Client) CreateSequential(path string, value []byte, acls []ACL) (string, error)
- func (c *Client) DefaultACL(perms int32) []ACL
- func (c *Client) Delete(path string) error
- func (c *Client) Exists(path string) (bool, error)
- func (c *Client) Get(path string) ([]byte, error)
- func (c *Client) Put(path string, value []byte) error
- type Config
- type Logger
- type SchemeAuth
- type SchemeID
Constants ¶
const ( PermRead = int32(zk.PermRead) PermWrite = int32(zk.PermWrite) PermCreate = int32(zk.PermCreate) PermDelete = int32(zk.PermDelete) PermAdmin = int32(zk.PermAdmin) PermAll = int32(zk.PermAll) )
Permissions bits to be used for ACLs
const DefaultAddr = "127.0.0.1:2181"
DefaultAddr is the default address for zookeeper.
Variables ¶
var ( // ErrZnodeDoesNotExist is returned if the requested znode does not exist. ErrZnodeDoesNotExist = zk.ErrNoNode // ErrZnodeAlreadyExists is returned if a given znode already exists. ErrZnodeAlreadyExists = zk.ErrNodeExists )
Functions ¶
This section is empty.
Types ¶
type ACL ¶
ACL defines permissions, a scheme and an ID.
func AuthACL ¶
AuthACL produces an ACL list containing a single ACL which uses the provided permissions, with the scheme "auth", and ID "", which is used by ZooKeeper to represent any authenticated user.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client exports the main API that users of this package will use
func (*Client) CreateAll ¶
CreateAll znodes for the path, including parents if necessary. value is only put into the last znode child.
func (*Client) CreateEphemeral ¶
CreateEphemeral creates an ephemeral znode.
func (*Client) CreateEphemeralSequential ¶
CreateEphemeralSequential creates an ephemeral, sequential znode
func (*Client) CreateSequential ¶
CreateSequential creates a sequential znode.
func (*Client) DefaultACL ¶
DefaultACL returns a slice with a single ACL of the given perms and default ID DefaultACL produces an ACL list containing a single ACL which uses the provided permissions and the default SchemeID passed through client config.
type Config ¶
type Config struct { // Address for zookeeper, an empty string will use DefaultAddr Addr string // If specified, all paths for the Client will be prefixed by this BasePath string // Authentication info for the connection Auth *SchemeAuth // Default ID to be used for Client.DefaultACL function DefaultID *SchemeID // A logger for the client Logger Logger }
Config defines the default parameters for zookeeper setup.
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger is used for debugging purposes
type SchemeAuth ¶
SchemeAuth composes scheme and auth
func ParseSchemeAuth ¶
func ParseSchemeAuth(schemeAuth string) (*SchemeAuth, error)
ParseSchemeAuth parses input such as "scheme:auth"