db

package
v0.0.0-...-5725a1b Latest Latest
Warning

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

Go to latest
Published: May 23, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildEventStreamClosed = errors.New("build event stream closed")
View Source
var ErrConfigComparisonFailed = errors.New("comparison with existing config failed during save")
View Source
var ErrEndOfBuildEventStream = errors.New("end of build event stream")
View Source
var ErrMultipleContainersFound = errors.New("multiple containers found for given identifier")

Functions

func NewNotificationsBus

func NewNotificationsBus(listener *pq.Listener, conn Conn) *notificationsBus

Types

type ConfigVersion

type ConfigVersion int

ConfigVersion is a sequence identifier used for compare-and-swap

type Conn

type Conn interface {
	Begin() (Tx, error)
	Close() error
	Driver() driver.Driver
	Exec(query string, args ...interface{}) (sql.Result, error)
	Ping() error
	Prepare(query string) (*sql.Stmt, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	SetMaxIdleConns(n int)
	SetMaxOpenConns(n int)
}

func Log

func Log(logger lager.Logger, conn Conn) Conn

func Wrap

func Wrap(sqlDB *sql.DB) Conn

func WrapWithError

func WrapWithError(sqlDB *sql.DB, err error) (Conn, error)

type DB

type DB interface {
	CreateTeam(team Team) (SavedTeam, error)
	CreateDefaultTeamIfNotExists() error

	CreatePipe(pipeGUID string, url string, teamName string) error
	GetPipe(pipeGUID string) (Pipe, error)

	GetTaskLock(logger lager.Logger, taskName string) (lock.Lock, bool, error)
}

type EventSource

type EventSource interface {
	Next() (event.Envelope, error)
	Close() error
}

type NotificationsBus

type NotificationsBus interface {
	Listen(channel string) (chan bool, error)
	Notify(channel string) error
	Unlisten(channel string, notify chan bool) error
}

type Notifier

type Notifier interface {
	Notify() <-chan struct{}
	Close() error
}

type Pipe

type Pipe struct {
	ID       string
	URL      string
	TeamName string
}

type ResourceCacheIdentifier

type ResourceCacheIdentifier struct {
	ResourceVersion atc.Version
	ResourceHash    string
}

type SQLDB

type SQLDB struct {
	// contains filtered or unexported fields
}

func NewSQL

func NewSQL(
	sqldbConnection Conn,
	bus *notificationsBus,
	lockFactory lock.LockFactory,
) *SQLDB

func (*SQLDB) AcquireContainerCreatingLock

func (db *SQLDB) AcquireContainerCreatingLock(logger lager.Logger, containerID int) (lock.Lock, bool, error)

func (*SQLDB) AcquireVolumeCreatingLock

func (db *SQLDB) AcquireVolumeCreatingLock(logger lager.Logger, volumeID int) (lock.Lock, bool, error)

func (*SQLDB) CreateDefaultTeamIfNotExists

func (db *SQLDB) CreateDefaultTeamIfNotExists() error

func (*SQLDB) CreatePipe

func (db *SQLDB) CreatePipe(pipeGUID string, url string, teamName string) error

func (*SQLDB) CreateTeam

func (db *SQLDB) CreateTeam(team Team) (SavedTeam, error)

func (*SQLDB) GetPipe

func (db *SQLDB) GetPipe(pipeGUID string) (Pipe, error)

func (*SQLDB) GetTaskLock

func (db *SQLDB) GetTaskLock(logger lager.Logger, taskName string) (lock.Lock, bool, error)

type SavedTeam

type SavedTeam struct {
	ID int
	Team
}

type Team

type Team struct {
	Name  string
	Admin bool
}

type TeamDB

type TeamDB interface {
	GetTeam() (SavedTeam, bool, error)
}

type TeamDBFactory

type TeamDBFactory interface {
	GetTeamDB(string) TeamDB
}

func NewTeamDBFactory

func NewTeamDBFactory(conn Conn, bus *notificationsBus, lockFactory lock.LockFactory) TeamDBFactory

type Tx

type Tx interface {
	Commit() error
	Exec(query string, args ...interface{}) (sql.Result, error)
	Prepare(query string) (*sql.Stmt, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	Rollback() error
	Stmt(stmt *sql.Stmt) *sql.Stmt
}

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 This file was generated by counterfeiter This file was generated by counterfeiter
lockfakes
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
migrationsfakes
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