dal

package
v0.361.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAL

type DAL struct {
	*libdal.Handle[DAL]
	// contains filtered or unexported fields
}

func New

func New(conn libdal.Connection) *DAL

func (*DAL) AcquireLease

func (d *DAL) AcquireLease(ctx context.Context, key leases.Key, ttl time.Duration, metadata optional.Option[any]) (leases.Lease, context.Context, error)

AcquireLease acquires a lease for the given key.

Will return leases.ErrConflict (not libdal.ErrConflict) if the lease is already held by another controller.

The returned context will be cancelled when the lease fails to renew.

func (*DAL) ExpireLeases

func (d *DAL) ExpireLeases(ctx context.Context) error

ExpireLeases expires (deletes) all leases that have expired.

func (*DAL) GetLeaseInfo

func (d *DAL) GetLeaseInfo(ctx context.Context, key leases.Key, metadata any) (expiry time.Time, err error)

GetLeaseInfo returns the metadata and expiry time for the lease with the given key.

metadata should be a pointer to the type that metadata should be unmarshaled into.

func (*DAL) NewLease

func (d *DAL) NewLease(ctx context.Context, key leases.Key, idempotencyKey uuid.UUID, ttl time.Duration) (*Lease, context.Context)

NewLease creates a new lease for the given key.

type Lease

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

Lease represents a lease that is held by a controller.

func (*Lease) Release

func (l *Lease) Release() error

func (*Lease) String

func (l *Lease) String() string

Directories

Path Synopsis
internal
sql

Jump to

Keyboard shortcuts

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