lock

package
v6.7.3-0...-1f455d7 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LockTypeResourceConfigChecking = iota
	LockTypeBuildTracking
	LockTypeBatch
	LockTypeVolumeCreating
	LockTypeContainerCreating
	LockTypeDatabaseMigration
	LockTypeActiveTasks
	LockTypeResourceScanning
	LockTypeJobScheduling
)

Variables

View Source
var ErrLostLock = errors.New("lock was lost while held, possibly due to connection breakage")

Functions

This section is empty.

Types

type Lock

type Lock interface {
	Release() error
}

type LockDB

type LockDB interface {
	Acquire(id LockID) (bool, error)
	Release(id LockID) (bool, error)
}

type LockFactory

type LockFactory interface {
	Acquire(logger lager.Logger, ids LockID) (Lock, bool, error)
}

func NewLockFactory

func NewLockFactory(
	conn *sql.DB,
	acquire LogFunc,
	release LogFunc,
) LockFactory

func NewTestLockFactory

func NewTestLockFactory(db LockDB) LockFactory

type LockID

type LockID []int

func NewActiveTasksLockID

func NewActiveTasksLockID() LockID

func NewBuildTrackingLockID

func NewBuildTrackingLockID(buildID int) LockID

func NewDatabaseMigrationLockID

func NewDatabaseMigrationLockID() LockID

func NewJobSchedulingLockID

func NewJobSchedulingLockID(jobID int) LockID

func NewResourceConfigCheckingLockID

func NewResourceConfigCheckingLockID(resourceConfigID int) LockID

func NewResourceScanningLockID

func NewResourceScanningLockID() LockID

func NewTaskLockID

func NewTaskLockID(taskName string) LockID

func NewVolumeCreatingLockID

func NewVolumeCreatingLockID(volumeID int) LockID

type LogFunc

type LogFunc func(logger lager.Logger, id LockID)

type NoopLock

type NoopLock struct{}

NoopLock is a fake lock for use when a lock is conditionally acquired.

func (NoopLock) Release

func (NoopLock) Release() error

Release does nothing. Successfully.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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