etcdsync

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

CSE Distributed Etcd lock

example

lock, _ := etcdsync.Lock("/test",-1, true)
defer lock.Unlock()
//do something
g += 1
fmt.Println(g)

Documentation

Index

Constants

View Source
const (
	DefaultLockTTL    = 60
	DefaultRetryTimes = 3
	RootPath          = "/cse/etcdsync"

	OperationGlobalLock = "GLOBAL_LOCK"
)

Variables

View Source
var (
	IsDebug bool
)

Functions

This section is empty.

Types

type DLock

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

func Lock

func Lock(key string, ttl int64, wait bool) (*DLock, error)

func NewDLock

func NewDLock(key string, ttl int64, wait bool) (l *DLock, err error)

func (*DLock) ID

func (m *DLock) ID() string

func (*DLock) Lock

func (m *DLock) Lock(wait bool) (err error)

func (*DLock) Unlock

func (m *DLock) Unlock() (err error)

Jump to

Keyboard shortcuts

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