Documentation ¶
Index ¶
- type DatabaseLeaser
- func (d *DatabaseLeaser) AcquireLease(ctx context.Context, key leases.Key, ttl time.Duration, ...) (leases.Lease, context.Context, error)
- func (d *DatabaseLeaser) ExpireLeases(ctx context.Context) error
- func (d *DatabaseLeaser) GetLeaseInfo(ctx context.Context, key leases.Key, metadata any) (expiry time.Time, err error)
- func (d *DatabaseLeaser) 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 DatabaseLeaser ¶
type DatabaseLeaser struct { *libdal.Handle[DatabaseLeaser] // contains filtered or unexported fields }
func NewDatabaseLeaser ¶
func NewDatabaseLeaser(conn libdal.Connection) *DatabaseLeaser
func (*DatabaseLeaser) AcquireLease ¶
func (d *DatabaseLeaser) 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 (*DatabaseLeaser) ExpireLeases ¶
func (d *DatabaseLeaser) ExpireLeases(ctx context.Context) error
ExpireLeases expires (deletes) all leases that have expired.
func (*DatabaseLeaser) GetLeaseInfo ¶
func (d *DatabaseLeaser) 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.