distributed_lock

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLockFail   = errors.New("lock fail")
	ErrUnLockFail = errors.New("Unlock fail")

	ErrDistributedLockType = errors.New("error distributed lock type")

	ErrEtcdAddrNil      = errors.New("etcd addr nil")
	ErrZkAddrNil        = errors.New("zk addr nil")
	ErrRedisAddrNil     = errors.New("redis addr nil")
	ErrCustomizeAddrNil = errors.New("customize addr nil")
)

Functions

This section is empty.

Types

type DistributedLockConfig

type DistributedLockConfig struct {
	Type           DistributedLockType
	TTl            int64
	Key            string
	EtcdAddrs      []string
	ZkAddrs        []string
	RedisAddrs     []string
	CustomizeAddrs []string
}

type DistributedLockManager

type DistributedLockManager interface {
	Lock(context.Context) (string, error)
	Unlock(ctx context.Context, value string) error
}

type DistributedLockType

type DistributedLockType string
const (
	EtcdDistributedLock      DistributedLockType = "etcd"
	ZkDistributedLock        DistributedLockType = "zk"
	RedLockDistributedLock   DistributedLockType = "red_lock"
	CustomizeDistributedLock DistributedLockType = "customize_lock"
)

type EtcdDistributedLockManager

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

func (*EtcdDistributedLockManager) Close

func (*EtcdDistributedLockManager) Lock

func (*EtcdDistributedLockManager) Unlock

func (e *EtcdDistributedLockManager) Unlock(ctx context.Context, value string) error

Jump to

Keyboard shortcuts

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