lock

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcd

func NewEtcd(c *Conf) *clientv3.Client

Types

type Conf

type Conf struct {
	Addr        []string
	DialTimeout int
}

type EtcdLock

type EtcdLock struct {
	// contains filtered or unexported fields
}

func NewEtcdLock

func NewEtcdLock(conn *clientv3.Client, key string, timeout int64) *EtcdLock

func (*EtcdLock) GetLockKey

func (lock *EtcdLock) GetLockKey() string

func (*EtcdLock) Lock

func (lock *EtcdLock) Lock() error

Lock 加锁 等待到超时时间

func (*EtcdLock) TryLock

func (lock *EtcdLock) TryLock() error

TryLock 加锁失败立马返回

func (*EtcdLock) UnLock

func (lock *EtcdLock) UnLock() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL