leases

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Overview

Package leases coordinates global, singleton activities.

Index

Constants

This section is empty.

Variables

Set is used by Wire.

Functions

func New

func New(ctx context.Context, cfg Config) (types.Leases, error)

New constructs an instance of types.Leases.

func ProvideLeases

func ProvideLeases(
	ctx context.Context, pool *types.StagingPool, stagingDB ident.StagingSchema,
) (types.Leases, error)

ProvideLeases is called by Wire to configure the work-leasing strategy.

This can be removed once stagingDB once SELECT FOR UPDATE uses replicated locks.

https://github.com/cockroachdb/cockroach/issues/100194

Types

type Config

type Config struct {
	Pool   *types.StagingPool // Database access.
	Target ident.Table        // The lease table.

	// Guard provides a quiescent period between when a lease is
	// considered to be expired (i.e. a lease callback's context is
	// canceled) and its published expiration time. This is useful for
	// situations where it may not be possible to immediately cancel all
	// side effects of a lease callback (e.g. it makes an external
	// network request).
	Guard time.Duration

	Lifetime   time.Duration // Duration of the lease.
	Poll       time.Duration // How often to re-check for an available lease.
	RetryDelay time.Duration // Delay between re-executing a callback.
}

Config is passed to New.

Jump to

Keyboard shortcuts

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