Documentation ¶
Index ¶
- Constants
- Variables
- func CreatePath(path string) (string, error)
- func IsLockInitialed() bool
- func RegisterConfigHandler(namespace string, key string, action HandlerFunc) error
- func ReleaseLock(lockName string) error
- func TryLock(lockName string) error
- type HandlerFunc
- type Status
- type Task
- type ZkBalancer
- type ZkLock
- type ZkLockConfig
Constants ¶
View Source
const ( Init = iota Assigned Releasing Deleting )
Variables ¶
View Source
var ZkClient *zk.Conn
Functions ¶
func CreatePath ¶
func IsLockInitialed ¶
func IsLockInitialed() bool
func RegisterConfigHandler ¶
func RegisterConfigHandler(namespace string, key string, action HandlerFunc) error
func ReleaseLock ¶
Types ¶
type HandlerFunc ¶
type ZkBalancer ¶
type ZkBalancer struct {
// contains filtered or unexported fields
}
func (*ZkBalancer) OnAssign ¶
func (zb *ZkBalancer) OnAssign(assignFunc func(tasks []Task) error)
worker callback WARN : as assignFunc may be called multi times, every time missing tasks should handle by client safely as accumulated releasing tasks,
those task may occur by history assignFunc calls, and should be finally released somehow
func (*ZkBalancer) Start ¶
func (zb *ZkBalancer) Start()
func (*ZkBalancer) Stop ¶
func (zb *ZkBalancer) Stop()
type ZkLock ¶
type ZkLock struct {
// contains filtered or unexported fields
}
func Initialize ¶
func Initialize(config ZkLockConfig) (*ZkLock, error)
type ZkLockConfig ¶
Click to show internal directories.
Click to hide internal directories.