lock

package
v0.0.0-...-7f11b89 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LockTypeResourceConfigChecking = iota
	LockTypeResourceTypeChecking
	LockTypeBuildTracking
	LockTypePipelineScheduling
	LockTypeResourceCheckingForJob
	LockTypeBatch
	LockTypeVolumeCreating
	LockTypeContainerCreating
)

Variables

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

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Connect() (DelegateConn, error)
}

type DelegateConn

type DelegateConn interface {
	Query(sql string, args ...interface{}) (*pgx.Rows, error)
	QueryRow(sql string, args ...interface{}) *pgx.Row
	Exec(sql string, arguments ...interface{}) (commandTag pgx.CommandTag, err error)
}

type Lock

type Lock interface {
	Acquire() (bool, error)
	Release() error
}

type LockDB

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

type LockFactory

type LockFactory interface {
	NewLock(logger lager.Logger, ids LockID) Lock
}

func NewLockFactory

func NewLockFactory(conn *RetryableConn) LockFactory

func NewTestLockFactory

func NewTestLockFactory(db LockDB) LockFactory

type LockID

type LockID []int

func NewBuildTrackingLockID

func NewBuildTrackingLockID(buildID int) LockID

func NewContainerCreatingLockID

func NewContainerCreatingLockID(containerID int) LockID

func NewPipelineSchedulingLockLockID

func NewPipelineSchedulingLockLockID(pipelineID int) LockID

func NewResourceCheckingForJobLockID

func NewResourceCheckingForJobLockID(jobID int) LockID

func NewResourceConfigCheckingLockID

func NewResourceConfigCheckingLockID(resourceConfigID int) LockID

func NewResourceTypeCheckingLockID

func NewResourceTypeCheckingLockID(resourceTypeID int) LockID

func NewTaskLockID

func NewTaskLockID(taskName string) LockID

func NewVolumeCreatingLockID

func NewVolumeCreatingLockID(volumeID int) LockID

type PgxConnector

type PgxConnector struct {
	PgxConfig pgx.ConnConfig
}

func (PgxConnector) Connect

func (c PgxConnector) Connect() (DelegateConn, error)

type RetryableConn

type RetryableConn struct {
	Connector Connector
	Conn      DelegateConn // *pgx.Conn
}

func (*RetryableConn) Exec

func (c *RetryableConn) Exec(sql string, arguments ...interface{}) (pgx.CommandTag, error)

func (*RetryableConn) QueryRow

func (c *RetryableConn) QueryRow(sql string, args ...interface{}) *pgx.Row

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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