Documentation ¶
Overview ¶
Package clustering provides an interface to register and list members in a cluster.
Index ¶
- Constants
- func CleanPath(path string) string
- func CreateParentPath(conn *zk.Conn, path string, acl []zk.ACL) error
- func CreatePath(conn *zk.Conn, path string, acl []zk.ACL) error
- type ClusterMember
- type MemberID
- type MemberListCallbackFunc
- type ZookeeperClusterMember
- func (z *ZookeeperClusterMember) MemberID() MemberID
- func (z *ZookeeperClusterMember) MemberList() ([]MemberID, error)
- func (z *ZookeeperClusterMember) MemberListCallback(callback MemberListCallbackFunc) error
- func (z *ZookeeperClusterMember) Register() error
- func (z *ZookeeperClusterMember) Unregister() error
Constants ¶
View Source
const ClusterMemberPath = "/members"
View Source
const DefaultACLPerms = zk.PermAll
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClusterMember ¶
type ClusterMember interface { // MemberID returns the unique identifier for this cluster member. MemberID() MemberID // MemberList returns a current list of the cluster members. Returns an error // if the list was unable to be retrieved. MemberList() ([]MemberID, error) // MemberListCallback will call the callback function once for every member // currently in the tree and then again for each future addition and removal. // Subsequent calls to MemberListCallback will cancel previous callbacks. MemberListCallback(callback MemberListCallbackFunc) error // Register will register this member with the cluster. Once a cluster member is // registered it should stay registered as long as the cluster member is alive. // If registration was unsuccessful an error is returned. Register() error // Unregister will unregister this member with the cluster. Unregister may not be // called so arrangements should be made for the cluster to unregister a // member if it dies unexpectedly. Unregister() error }
ClusterMember is one member of a cluster.
type MemberID ¶
type MemberID string
MemberID is a string identifier that is unique for each cluster member.
type MemberListCallbackFunc ¶
MemberListCallbackFunc is a function that will be called once for every member added or removed from the cluster.
type ZookeeperClusterMember ¶
type ZookeeperClusterMember struct {
// contains filtered or unexported fields
}
func NewZookeeperClusterMember ¶
func NewZookeeperClusterMember(config *configuration.GatewayConfig, conn *zk.Conn, member string) *ZookeeperClusterMember
func (*ZookeeperClusterMember) MemberID ¶
func (z *ZookeeperClusterMember) MemberID() MemberID
func (*ZookeeperClusterMember) MemberList ¶
func (z *ZookeeperClusterMember) MemberList() ([]MemberID, error)
func (*ZookeeperClusterMember) MemberListCallback ¶
func (z *ZookeeperClusterMember) MemberListCallback(callback MemberListCallbackFunc) error
func (*ZookeeperClusterMember) Register ¶
func (z *ZookeeperClusterMember) Register() error
Register will create an ephemeral Zookeeper node in a cluster member tree. The node will be removed automatically by Zookeeper if the session disconnects.
func (*ZookeeperClusterMember) Unregister ¶
func (z *ZookeeperClusterMember) Unregister() error
Click to show internal directories.
Click to hide internal directories.