lock

package
v0.0.0-...-8f2995f Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LockDefaultTimeout       = time.Hour
	ReleaseLockRetryAmount   = 3
	ReleaseLockRetryInterval = time.Second * 10
)

Variables

This section is empty.

Functions

func AcquireLock

func AcquireLock(kind string, name string, timeout time.Duration) bool

timeout 0 means default time out

func LockAvailable

func LockAvailable(kind string, name string) bool

func ReleaseLock

func ReleaseLock(kind string, name string) error

func ReloadStorage

func ReloadStorage(storageType int) error

Types

type DummyError

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

func (*DummyError) Error

func (dummyError *DummyError) Error() string

type Lock

type Lock struct {
	Name        string
	Timeout     time.Duration
	CreatedTime time.Time
	ExpiredTime time.Time
	Deleted     bool
}

type Storage

type Storage interface {
	LoadAllLock() ([]Lock, error)
	// contains filtered or unexported methods
}

func GetStorage

func GetStorage() Storage

type StorageDummy

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

func (*StorageDummy) LoadAllLock

func (storageDummy *StorageDummy) LoadAllLock() ([]Lock, error)

func (*StorageDummy) ShouldCheck

func (storageDummy *StorageDummy) ShouldCheck() bool

type StorageEtcd

type StorageEtcd struct {
}

func (*StorageEtcd) LoadAllLock

func (storageEtcd *StorageEtcd) LoadAllLock() ([]Lock, error)

Jump to

Keyboard shortcuts

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