Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLockFail = errors.New("lock fail") ErrUnLockFail = errors.New("Unlock fail") ErrDistributedLockType = errors.New("error distributed lock type") ErrEtcdAddrNil = errors.New("etcd addr nil") ErrZkAddrNil = errors.New("zk addr nil") ErrRedisAddrNil = errors.New("redis addr nil") ErrCustomizeAddrNil = errors.New("customize addr nil") )
Functions ¶
This section is empty.
Types ¶
type DistributedLockConfig ¶
type DistributedLockManager ¶
type DistributedLockManager interface { Lock(context.Context) (string, error) Unlock(ctx context.Context, value string) error }
func NewDistributedLockManager ¶
func NewDistributedLockManager(ctx context.Context, conf DistributedLockConfig) (DistributedLockManager, error)
type DistributedLockType ¶
type DistributedLockType string
const ( EtcdDistributedLock DistributedLockType = "etcd" ZkDistributedLock DistributedLockType = "zk" RedLockDistributedLock DistributedLockType = "red_lock" CustomizeDistributedLock DistributedLockType = "customize_lock" )
type EtcdDistributedLockManager ¶
type EtcdDistributedLockManager struct {
// contains filtered or unexported fields
}
func NewEtcdDistributedLockManager ¶
func NewEtcdDistributedLockManager(ctx context.Context, conf DistributedLockConfig) (*EtcdDistributedLockManager, error)
func (*EtcdDistributedLockManager) Close ¶
func (e *EtcdDistributedLockManager) Close(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.