locking

package
v0.0.0-...-1864f74 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDistributedMutexBuilderFunc

func NewDistributedMutexBuilderFunc(etcdclient *etcdclient.Client) func(string) (DistributedMutex, error)

Types

type DistributedMutex

type DistributedMutex interface {
	Key() string
	Lock(ctx context.Context) error
	TryLock(ctx context.Context) error
	Unlock(ctx context.Context) error
}

func NewDistributedMutex

func NewDistributedMutex(etcdclient *etcdclient.Client, pfx string) (DistributedMutex, error)

type MutexStore

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

MutexStore allows reuse of the same dist mutex in Etcd for a given key.

func NewMutexStore

func NewMutexStore(mutexBuilderFunc func(string) (DistributedMutex, error), collector collector.Collector) *MutexStore

func (*MutexStore) Delete

func (m *MutexStore) Delete(keys ...string)

func (*MutexStore) Get

func (m *MutexStore) Get(key string) (DistributedMutex, error)

type Mutexer

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

Mutexer locks and unlocks mutexes locally based on key, with garbage collection method.

func NewMutexer

func NewMutexer(collector collector.Collector) *Mutexer

func (*Mutexer) Delete

func (o *Mutexer) Delete(keys ...string)

func (*Mutexer) Get

func (o *Mutexer) Get(key string) *sync.RWMutex

Jump to

Keyboard shortcuts

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