Documentation ¶
Index ¶
- type DAL
- func (d *DAL) AcquireLease(ctx context.Context, key leases.Key, ttl time.Duration, ...) (leases.Lease, context.Context, error)
- func (d *DAL) ExpireLeases(ctx context.Context) error
- func (d *DAL) GetLeaseInfo(ctx context.Context, key leases.Key, metadata any) (expiry time.Time, err error)
- func (d *DAL) NewLease(ctx context.Context, key leases.Key, idempotencyKey uuid.UUID, ...) (*Lease, context.Context)
- type Lease
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAL ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.