dblock

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LeaseSeconds = 5

Variables

This section is empty.

Functions

func IsLockingFailed

func IsLockingFailed(err error) bool

Types

type Lock

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

func (*Lock) Active

func (l *Lock) Active() bool

func (*Lock) Ctx

func (l *Lock) Ctx() context.Context

func (*Lock) Name

func (l *Lock) Name() string

func (*Lock) Release

func (l *Lock) Release() bool

type Locker

type Locker struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func New

func New(db *ent.Client, leaseSeconds int64) *Locker

func (*Locker) TryAcquire

func (l *Locker) TryAcquire(pctx context.Context, id string, heartbeatSeconds int64) (*Lock, error)

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

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