etcdlock

package
v0.0.0-...-06bcc1c Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

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

Mutex is etcdv3 lock

func New

func New(cli *clientv3.Client, key string, ttl time.Duration) (*Mutex, error)

New new a lock

func (*Mutex) Lock

func (m *Mutex) Lock(ctx context.Context) (context.Context, error)

Lock get locked

func (*Mutex) TryLock

func (m *Mutex) TryLock(ctx context.Context) (context.Context, error)

TryLock tries to lock returns error if the lock is already acquired by someone else

func (*Mutex) Unlock

func (m *Mutex) Unlock(ctx context.Context) error

Unlock unlock

Jump to

Keyboard shortcuts

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