distrubutedlock

package
v0.0.0-...-b81d553 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLockAcquired    = errors.New("lock already acquired")
	ErrLockNotAcquired = errors.New("lock not acquired")
)

Functions

func Init

func Init(ctx context.Context, client *mongo.Client, dbName, collectionName string) error

Types

type DistributedLock

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

func New

func New(lockKey string, expiration time.Duration, labels map[string]string) *DistributedLock

func (*DistributedLock) Acquire

func (d *DistributedLock) Acquire(ctx context.Context) error

func (*DistributedLock) GetLabels

func (d *DistributedLock) GetLabels(ctx context.Context) (map[string]string, error)

func (*DistributedLock) IsLocked

func (d *DistributedLock) IsLocked(ctx context.Context) (bool, error)

func (*DistributedLock) Release

func (d *DistributedLock) Release(ctx context.Context) error

Jump to

Keyboard shortcuts

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