Documentation ¶
Index ¶
Constants ¶
View Source
const (
//BaseLockNode holds all distribute locks
DefaultLockNodeBase = "/distribute-locks"
)
Variables ¶
This section is empty.
Functions ¶
func WithBasePath ¶
func WithBasePath(path string) func(locker *DistributeLocker)
WithBasePath sets default lock node path base dir
func WithTimeout ¶
func WithTimeout(n time.Duration) func(locker *DistributeLocker)
Types ¶
type DistributeLock ¶
DistributeLock defines interface for all distribution locks
type DistributeLocker ¶
type DistributeLocker struct {
// contains filtered or unexported fields
}
DistributeLocker implements a distribute lock with zookeeper
func NewLocker ¶
func NewLocker(conn *zk.Conn, opt ...func(locker *DistributeLocker)) (*DistributeLocker, error)
NewLocker returns a locker with a distribute lock created in zk
func (*DistributeLocker) Lock ¶
func (locker *DistributeLocker) Lock(lockName string) error
func (*DistributeLocker) Name ¶
func (locker *DistributeLocker) Name() string
Click to show internal directories.
Click to hide internal directories.