Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeLocker ¶ added in v0.4.10
配置分布式锁
Types ¶
type DistributeLock ¶ added in v0.4.10
type DistributeLock struct {
// contains filtered or unexported fields
}
Etcd 分布式锁
var Locker *DistributeLock
func NewDistributeLock ¶ added in v0.4.10
func NewDistributeLock(config clientv3.Config) (*DistributeLock, error)
NewDistributeLock creates a new DistributeLock
func (*DistributeLock) Lock ¶ added in v0.4.10
func (d *DistributeLock) Lock(prefix string) (cancel func(), err1 error)
Lock 尝试获得锁(阻塞)
func (*DistributeLock) TryLock ¶ added in v0.4.10
func (d *DistributeLock) TryLock(prefix string) (cancel func(), err1 error)
TryLock 尝试获得锁(非阻塞)
type Registry ¶
type SelectAlgorithm ¶
type SelectAlgorithm int
const AlgRandom SelectAlgorithm = 0
const AlgRoundRobin SelectAlgorithm = 1
Click to show internal directories.
Click to hide internal directories.