dlock

package
v0.0.0-...-0b61f1f Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConsulAddress    string
	Key              string
	TTLSecond        int
	LockWaitTime     time.Duration
	LockTryOnce      bool
	MonitorRetries   int
	UnlockAndDestroy bool
}

func NewDefaultConfig

func NewDefaultConfig(consulAddress string, key string) *Config

type DLock

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

func NewDLock

func NewDLock(config *Config) (*DLock, error)

func (*DLock) IsHeld

func (dl *DLock) IsHeld() bool

func (*DLock) Lock

func (dl *DLock) Lock() (bool, error)

func (*DLock) Unlock

func (dl *DLock) Unlock() error

Jump to

Keyboard shortcuts

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