etcdlock

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 7 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 an etcd session based distributed lock.

func New

func New(pool *Pool, key string, timeout time.Duration) (*Mutex, error)

New creates a Mutex on key over a pooled session; Lock and Unlock each give up after timeout.

func (*Mutex) Lock

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

func (*Mutex) Unlock

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

type Pool added in v0.1.4

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

Pool keeps etcd sessions alive between locks.

func NewPool added in v0.1.4

func NewPool(cli *clientv3.Client, ttl time.Duration) *Pool

NewPool builds a pool whose sessions carry a lease of ttl.

Jump to

Keyboard shortcuts

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