Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAndIncrement(zc ZK, key registry.Path, current, increment int) (int, error)
- func Connect(servers []string, timeout time.Duration) (*zookeeper, error)
- func CreateOrSet(zc ZK, key registry.Path, value interface{}, ephemeral ...bool) error
- func CreateOrSetBytes(zc ZK, key registry.Path, value []byte, ephemeral ...bool) error
- func CreateOrSetInt(zc ZK, key registry.Path, value int, ephemeral ...bool) error
- func CreateOrSetString(zc ZK, key registry.Path, value string, ephemeral ...bool) error
- func DeleteObject(zc ZK, key registry.Path) error
- func GetBytes(zc ZK, key registry.Path) []byte
- func GetInt(zc ZK, key registry.Path) *int
- func GetObject(zc ZK, key registry.Path, value interface{}) error
- func GetString(zc ZK, key registry.Path) *string
- func Increment(zc ZK, key registry.Path, increment int) error
- func NewChange(c registry.Change, zkc ZK, persistent ...bool) watch
- func NewCreate(c registry.Create, zkc ZK, persistent ...bool) watch
- func NewDelete(d registry.Delete, zkc ZK, persistent ...bool) watch
- func NewMembers(m registry.Members, zkc ZK, persistent ...bool) watch
- func PathExists(zc ZK, key registry.Path) bool
- func Resolve(zc ZK, key registry.Path, value string) (registry.Path, string, error)
- func VersionLockAndExecute(zc ZK, key registry.Path, rev int, f func() error) (int, error)
- func Visit(zc ZK, key registry.Path, v func(registry.Path, []byte) bool) error
- func ZkHosts() []string
- type Change
- type Conditions
- type Create
- type Delete
- type Dir
- func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error
- func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
- func (d *Dir) Lookup(ctx context.Context, name string) (fs.Node, error)
- func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)
- func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)
- func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error
- type Event
- type FS
- type File
- func (f *File) Attr(ctx context.Context, a *fuse.Attr) error
- func (f *File) Flush(ctx context.Context, req *fuse.FlushRequest) error
- func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)
- func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error
- func (f *File) Release(ctx context.Context, req *fuse.ReleaseRequest) error
- func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
- func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error
- type Members
- type Node
- func (this *Node) CheckAndIncrement(current, increment int) (int, error)
- func (this *Node) Children() ([]*Node, error)
- func (this *Node) ChildrenRecursive() ([]*Node, error)
- func (this *Node) CountChildren() int32
- func (this *Node) Delete() error
- func (this *Node) FilterChildrenRecursive(filter func(*Node) bool) ([]*Node, error)
- func (this *Node) Get() error
- func (z *Node) GetBasename() string
- func (z *Node) GetPath() string
- func (z *Node) GetValue() []byte
- func (z *Node) GetValueString() string
- func (this *Node) Increment(increment int) (int, error)
- func (z *Node) IsLeaf() bool
- func (this *Node) ListAllRecursive() ([]string, error)
- func (this *Node) Set(value []byte) error
- func (this *Node) VisitChildrenRecursive(accept func(*Node) bool) ([]*Node, error)
- func (this *Node) Watch(f func(Event)) (chan<- bool, error)
- func (this *Node) WatchChildren(f func(Event)) (chan<- bool, error)
- type ZK
Constants ¶
View Source
const ( PrefixEnv = "env://" PrefixZk = "zk://" )
View Source
const ( StateUnknown = zk.StateUnknown StateDisconnected = zk.StateDisconnected StateConnecting = zk.StateConnecting StateAuthFailed = zk.StateAuthFailed StateConnectedReadOnly = zk.StateConnectedReadOnly StateSaslAuthenticated = zk.StateSaslAuthenticated StateExpired = zk.StateExpired StateConnected = zk.StateConnected StateHasSession = zk.StateHasSession )
Variables ¶
View Source
var ( ErrNotInitialized = errors.New("not-initialized") ErrNotWatching = errors.New("not-watching") ErrInvalidState = errors.New("invalid-state") ErrTimeout = errors.New("timeout") )
View Source
var ( ErrNotConnected = errors.New("zk-not-initialized") ErrConflict = errors.New("error-conflict") ErrZkDisconnected = errors.New("error-zk-disconnected") ErrNotExist = zk.ErrNoNode ErrConnectionClosed = zk.ErrConnectionClosed ErrUnknown = zk.ErrUnknown ErrAPIError = zk.ErrAPIError ErrNoAuth = zk.ErrNoAuth ErrBadVersion = zk.ErrBadVersion ErrNoChildrenForEphemerals = zk.ErrNoChildrenForEphemerals ErrNodeExists = zk.ErrNodeExists ErrNotEmpty = zk.ErrNotEmpty ErrSessionExpired = zk.ErrSessionExpired ErrInvalidACL = zk.ErrInvalidACL ErrAuthFailed = zk.ErrAuthFailed ErrClosing = zk.ErrClosing ErrNothing = zk.ErrNothing ErrSessionMoved = zk.ErrSessionMoved )
Functions ¶
func CheckAndIncrement ¶
func CreateOrSet ¶
func CreateOrSetBytes ¶
func CreateOrSetInt ¶
func CreateOrSetString ¶
func Resolve ¶
If value begins with env:// then automatically resolve the pointer recursively. Returns key, value, error
func VersionLockAndExecute ¶
A simple non-ephemeral lock held at key and we use simply by incrementing and using it like a compare and swap.
Types ¶
type Change ¶
func (*Change) SetGroupChan ¶
func (this *Change) SetGroupChan(c chan<- watch)
func (*Change) SetTimeout ¶
type Conditions ¶
type Conditions struct { registry.Conditions // contains filtered or unexported fields }
func NewConditions ¶
func NewConditions(c registry.Conditions, zkc ZK, persistent ...bool) *Conditions
func (*Conditions) Init ¶
func (this *Conditions) Init(zkc ZK) *Conditions
func (*Conditions) Pending ¶
func (this *Conditions) Pending() []watch
func (*Conditions) Wait ¶
func (this *Conditions) Wait() error
Simply blocks until it's either true or a timeout occurs. The error will indicate whether the condition is met or a timeout took place.
type Create ¶
func (*Create) SetGroupChan ¶
func (this *Create) SetGroupChan(c chan<- watch)
func (*Create) SetTimeout ¶
type Delete ¶
func (*Delete) SetGroupChan ¶
func (this *Delete) SetGroupChan(c chan<- watch)
func (*Delete) SetTimeout ¶
type Dir ¶ added in v1.0.2
type Dir struct {
// contains filtered or unexported fields
}
func (*Dir) ReadDirAll ¶ added in v1.0.2
type File ¶ added in v1.0.2
type File struct {
// contains filtered or unexported fields
}
func (*File) Open ¶ added in v1.0.2
func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)
func (*File) Read ¶ added in v1.0.2
func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error
func (*File) Setattr ¶ added in v1.0.2
func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
func (*File) Write ¶ added in v1.0.2
func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error
type Members ¶
func (*Members) SetGroupChan ¶
func (this *Members) SetGroupChan(c chan<- watch)
func (*Members) SetTimeout ¶
type Node ¶
type Node struct { Path string Value []byte Members []string Stats *zk.Stat Leaf bool // contains filtered or unexported fields }
func (*Node) CheckAndIncrement ¶
func (*Node) ChildrenRecursive ¶
func (*Node) CountChildren ¶
func (*Node) FilterChildrenRecursive ¶
Recursively go through all the children. Apply filter for each node. If filter returns true for the particular node, this node (though not necessarily all its children) will be excluded. This is useful for searching through all true by name or by whether it's a parent node or not.
func (*Node) GetBasename ¶
func (*Node) GetValueString ¶
func (*Node) ListAllRecursive ¶
func (*Node) VisitChildrenRecursive ¶
type ZK ¶
type ZK interface { Reconnect() error Close() error Events() <-chan Event Create(string, []byte) (*Node, error) CreateEphemeral(string, []byte) (*Node, error) Get(string) (*Node, error) Watch(string, func(Event)) (chan<- bool, error) WatchChildren(string, func(Event)) (chan<- bool, error) KeepWatch(string, func(Event) bool, ...func(error)) (chan<- bool, error) Delete(string) error }
Click to show internal directories.
Click to hide internal directories.