db

package
v0.0.0-...-484f906 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoVerionsSatisfiedPassedConstraints string = "no versions satisfy passed constraints"
	NoVersionsAvailable                 string = "no versions available"
	PinnedVersionUnavailable            string = "pinned version %s is not available"
)
View Source
const (
	ContainerStageCheck = "check"
	ContainerStageGet   = "get"
	ContainerStageRun   = "run"
)
View Source
const (
	LockTypeResourceChecking = iota
	LockTypeResourceTypeChecking
	LockTypeBuildTracking
	LockTypePipelineScheduling
	LockTypeResourceCheckingForJob
	LockTypeBatch
)

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 ErrInvalidIdentifier = errors.New("invalid container identifier")
View Source
var ErrMultipleContainersFound = errors.New("multiple containers found for given identifier")

Functions

func NewNotificationsBus

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

func NewPipelineDBFactory

func NewPipelineDBFactory(
	sqldbConnection Conn,
	bus *notificationsBus,
	lockFactory LockFactory,
) *pipelineDBFactory

Types

type BasicAuth

type BasicAuth struct {
	BasicAuthUsername string `json:"basic_auth_username"`
	BasicAuthPassword string `json:"basic_auth_password"`
}

func (*BasicAuth) EncryptedJSON

func (auth *BasicAuth) EncryptedJSON() (string, error)

type Build

type Build interface {
	ID() int
	Name() string
	JobName() string
	PipelineName() string
	TeamName() string
	TeamID() int
	Engine() string
	EngineMetadata() string
	Status() Status
	StartTime() time.Time
	EndTime() time.Time
	ReapTime() time.Time
	IsOneOff() bool
	IsScheduled() bool
	IsRunning() bool

	Reload() (bool, error)

	Events(from uint) (EventSource, error)
	SaveEvent(event atc.Event) error

	GetVersionedResources() (SavedVersionedResources, error)
	GetResources() ([]BuildInput, []BuildOutput, error)

	Start(string, string) (bool, error)
	Finish(status Status) error
	MarkAsFailed(cause error) error
	Abort() error
	AbortNotifier() (Notifier, error)

	AcquireTrackingLock(logger lager.Logger, interval time.Duration) (Lock, bool, error)

	GetPreparation() (BuildPreparation, bool, error)

	SaveEngineMetadata(engineMetadata string) error

	SaveInput(input BuildInput) (SavedVersionedResource, error)
	SaveOutput(vr VersionedResource, explicit bool) (SavedVersionedResource, error)

	SaveImageResourceVersion(planID atc.PlanID, identifier ResourceCacheIdentifier) error
	GetImageResourceCacheIdentifiers() ([]ResourceCacheIdentifier, error)

	GetConfig() (atc.Config, ConfigVersion, error)

	GetPipeline() (SavedPipeline, error)
}

type BuildInput

type BuildInput struct {
	Name string

	VersionedResource

	FirstOccurrence bool
}

type BuildOutput

type BuildOutput struct {
	VersionedResource
}

type BuildPreparation

type BuildPreparation struct {
	BuildID             int
	PausedPipeline      BuildPreparationStatus
	PausedJob           BuildPreparationStatus
	MaxRunningBuilds    BuildPreparationStatus
	Inputs              map[string]BuildPreparationStatus
	InputsSatisfied     BuildPreparationStatus
	MissingInputReasons MissingInputReasons
}

type BuildPreparationStatus

type BuildPreparationStatus string
const (
	BuildPreparationStatusUnknown     BuildPreparationStatus = "unknown"
	BuildPreparationStatusBlocking    BuildPreparationStatus = "blocking"
	BuildPreparationStatusNotBlocking BuildPreparationStatus = "not_blocking"
)

type COWIdentifier

type COWIdentifier struct {
	ParentVolumeHandle string
}

func (COWIdentifier) String

func (i COWIdentifier) String() string

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 Connector

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

type Container

type Container struct {
	ContainerIdentifier
	ContainerMetadata
}

type ContainerIdentifier

type ContainerIdentifier struct {
	// if it's a resource check container
	ResourceID          int
	ResourceTypeVersion atc.Version
	CheckType           string
	CheckSource         atc.Source

	// if it's a step container
	BuildID int
	PlanID  atc.PlanID

	// for the check + get stages of a container with a resource backed image
	ImageResourceType   string
	ImageResourceSource atc.Source

	Stage ContainerStage
}

type ContainerMetadata

type ContainerMetadata struct {
	Handle               string
	WorkerName           string
	BuildName            string
	ResourceName         string
	PipelineID           int
	PipelineName         string
	TeamID               int
	JobName              string
	StepName             string
	Type                 ContainerType
	WorkingDirectory     string
	EnvironmentVariables []string
	Attempts             []int
	User                 string
}

type ContainerStage

type ContainerStage string

ContainerStage is used to distinguish between the 3 potential containers in use by a step, as we'll need to run a 'check' and 'get' for the image used by the container, which themselves correspond to containers.

type ContainerType

type ContainerType string
const (
	ContainerTypeCheck ContainerType = "check"
	ContainerTypeGet   ContainerType = "get"
	ContainerTypePut   ContainerType = "put"
	ContainerTypeTask  ContainerType = "task"
)

func ContainerTypeFromString

func ContainerTypeFromString(containerType string) (ContainerType, error)

func (ContainerType) String

func (containerType ContainerType) String() string

type DB

type DB interface {
	GetTeams() ([]SavedTeam, error)
	CreateTeam(team Team) (SavedTeam, error)
	CreateDefaultTeamIfNotExists() error
	DeleteTeamByName(teamName string) error

	GetAllStartedBuilds() ([]Build, error)
	GetPublicBuilds(page Page) ([]Build, Pagination, error)

	FindJobIDForBuild(buildID int) (int, bool, error)

	CreatePipe(pipeGUID string, url string, teamID int) error
	GetPipe(pipeGUID string) (Pipe, error)

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

	DeleteBuildEventsByBuildIDs(buildIDs []int) error

	Workers() ([]SavedWorker, error) // auto-expires workers based on ttl
	GetWorker(workerName string) (SavedWorker, bool, error)
	SaveWorker(WorkerInfo, time.Duration) (SavedWorker, error)

	GetContainer(string) (SavedContainer, bool, error)
	CreateContainer(container Container, ttl time.Duration, maxLifetime time.Duration, volumeHandles []string) (SavedContainer, error)
	FindContainerByIdentifier(ContainerIdentifier) (SavedContainer, bool, error)
	FindLatestSuccessfulBuildsPerJob() (map[int]int, error)
	FindJobContainersFromUnsuccessfulBuilds() ([]SavedContainer, error)
	UpdateExpiresAtOnContainer(handle string, ttl time.Duration) error
	ReapContainer(handle string) error

	DeleteContainer(string) error

	InsertVolume(data Volume) error
	GetVolumes() ([]SavedVolume, error)
	GetVolumesByIdentifier(VolumeIdentifier) ([]SavedVolume, error)
	ReapVolume(string) error
	SetVolumeTTLAndSizeInBytes(string, time.Duration, int64) error
	SetVolumeTTL(string, time.Duration) error
	GetVolumeTTL(volumeHandle string) (time.Duration, bool, error)
	GetVolumesForOneOffBuildImageResources() ([]SavedVolume, error)
}

type Dashboard

type Dashboard []DashboardJob

type DashboardJob

type DashboardJob struct {
	Job SavedJob

	FinishedBuild Build
	NextBuild     Build
}

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 EventSource

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

type FirstLoggedBuildIDDecreasedError

type FirstLoggedBuildIDDecreasedError struct {
	Job   string
	OldID int
	NewID int
}

func (FirstLoggedBuildIDDecreasedError) Error

type GenericOAuth

type GenericOAuth struct {
	AuthURL       string            `json:"auth_url"`
	AuthURLParams map[string]string `json:"auth_url_params"`
	TokenURL      string            `json:"token_url"`
	ClientID      string            `json:"client_id"`
	ClientSecret  string            `json:"client_secret"`
	DisplayName   string            `json:"display_name"`
	Scope         string            `json:"scope"`
}

type GitHubAuth

type GitHubAuth struct {
	ClientID      string       `json:"client_id"`
	ClientSecret  string       `json:"client_secret"`
	Organizations []string     `json:"organizations"`
	Teams         []GitHubTeam `json:"teams"`
	Users         []string     `json:"users"`
	AuthURL       string       `json:"auth_url"`
	TokenURL      string       `json:"token_url"`
	APIURL        string       `json:"api_url"`
}

type GitHubTeam

type GitHubTeam struct {
	OrganizationName string `json:"organization_name"`
	TeamName         string `json:"team_name"`
}

type ImportIdentifier

type ImportIdentifier struct {
	WorkerName string
	Path       string
	Version    *string
}

func (ImportIdentifier) String

func (i ImportIdentifier) String() string

type Job

type Job struct {
	Name string
}

type Lock

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

type LockDB

type LockDB interface {
	Acquire(id LockID) (bool, error)
	Release(id LockID) 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

type MetadataField

type MetadataField struct {
	Name  string
	Value string
}

type MissingInputReasons

type MissingInputReasons map[string]string

func (MissingInputReasons) RegisterNoVersions

func (mir MissingInputReasons) RegisterNoVersions(inputName string)

func (MissingInputReasons) RegisterPassedConstraint

func (mir MissingInputReasons) RegisterPassedConstraint(inputName string)

func (MissingInputReasons) RegisterPinnedVersionUnavailable

func (mir MissingInputReasons) RegisterPinnedVersionUnavailable(inputName string, version string)

type Notifier

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

type OutputIdentifier

type OutputIdentifier struct {
	Name string
}

func (OutputIdentifier) String

func (i OutputIdentifier) String() string

type Page

type Page struct {
	Since int // exclusive
	Until int // exclusive

	From int // inclusive
	To   int // inclusive

	Limit int
}

type Pagination

type Pagination struct {
	Previous *Page
	Next     *Page
}

type PgxConnector

type PgxConnector struct {
	PgxConfig pgx.ConnConfig
}

func (PgxConnector) Connect

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

type Pipe

type Pipe struct {
	ID     string
	URL    string
	TeamID int
}

type Pipeline

type Pipeline struct {
	Name    string
	Config  atc.Config
	Version ConfigVersion
}

type PipelineDB

type PipelineDB interface {
	Pipeline() SavedPipeline
	GetPipelineName() string
	GetPipelineID() int
	ScopedName(string) string
	TeamID() int
	Config() atc.Config
	ConfigVersion() ConfigVersion

	Reload() (bool, error)

	Pause() error
	Unpause() error
	IsPaused() (bool, error)
	IsPublic() bool
	UpdateName(string) error
	Destroy() error

	AcquireSchedulingLock(lager.Logger, time.Duration) (Lock, bool, error)

	GetResource(resourceName string) (SavedResource, bool, error)
	GetResources() ([]SavedResource, bool, error)
	GetResourceType(resourceTypeName string) (SavedResourceType, bool, error)
	GetResourceVersions(resourceName string, page Page) ([]SavedVersionedResource, Pagination, bool, error)

	PauseResource(resourceName string) error
	UnpauseResource(resourceName string) error

	SaveResourceVersions(atc.ResourceConfig, []atc.Version) error
	SaveResourceTypeVersion(atc.ResourceType, atc.Version) error
	GetLatestVersionedResource(resourceName string) (SavedVersionedResource, bool, error)
	GetLatestEnabledVersionedResource(resourceName string) (SavedVersionedResource, bool, error)
	EnableVersionedResource(versionedResourceID int) error
	DisableVersionedResource(versionedResourceID int) error
	SetResourceCheckError(resource SavedResource, err error) error
	AcquireResourceCheckingLock(logger lager.Logger, resource SavedResource, length time.Duration, immediate bool) (Lock, bool, error)
	AcquireResourceTypeCheckingLock(logger lager.Logger, resourceType SavedResourceType, length time.Duration, immediate bool) (Lock, bool, error)

	GetJobs() ([]SavedJob, error)
	GetJob(job string) (SavedJob, bool, error)
	PauseJob(job string) error
	UnpauseJob(job string) error
	SetMaxInFlightReached(string, bool) error
	UpdateFirstLoggedBuildID(job string, newFirstLoggedBuildID int) error

	GetJobFinishedAndNextBuild(job string) (Build, Build, error)

	GetJobBuilds(job string, page Page) ([]Build, Pagination, error)
	GetAllJobBuilds(job string) ([]Build, error)

	GetJobBuild(job string, build string) (Build, bool, error)
	CreateJobBuild(job string) (Build, error)
	EnsurePendingBuildExists(jobName string) error
	GetPendingBuildsForJob(jobName string) ([]Build, error)
	GetAllPendingBuilds() (map[string][]Build, error)
	UseInputsForBuild(buildID int, inputs []BuildInput) error
	AcquireResourceCheckingForJobLock(logger lager.Logger, jobName string) (Lock, bool, error)

	LoadVersionsDB() (*algorithm.VersionsDB, error)
	GetVersionedResourceByVersion(atcVersion atc.Version, resourceName string) (SavedVersionedResource, bool, error)
	SaveIndependentInputMapping(inputMapping algorithm.InputMapping, jobName string) error
	GetIndependentBuildInputs(jobName string) ([]BuildInput, error)
	SaveNextInputMapping(inputMapping algorithm.InputMapping, jobName string) error
	GetNextBuildInputs(jobName string) ([]BuildInput, bool, error)
	DeleteNextInputMapping(jobName string) error

	GetRunningBuildsBySerialGroup(jobName string, serialGroups []string) ([]Build, error)
	GetNextPendingBuildBySerialGroup(jobName string, serialGroups []string) (Build, bool, error)

	UpdateBuildToScheduled(buildID int) (bool, error)
	SaveInput(buildID int, input BuildInput) (SavedVersionedResource, error)
	SaveOutput(buildID int, vr VersionedResource, explicit bool) (SavedVersionedResource, error)
	GetBuildsWithVersionAsInput(versionedResourceID int) ([]Build, error)
	GetBuildsWithVersionAsOutput(versionedResourceID int) ([]Build, error)

	GetDashboard() (Dashboard, atc.GroupConfigs, error)

	Expose() error
	Hide() error
}

type PipelineDBFactory

type PipelineDBFactory interface {
	Build(pipeline SavedPipeline) PipelineDB
}

type PipelinePausedState

type PipelinePausedState string
const (
	PipelinePaused   PipelinePausedState = "paused"
	PipelineUnpaused PipelinePausedState = "unpaused"
	PipelineNoChange PipelinePausedState = "nochange"
)

func (PipelinePausedState) Bool

func (state PipelinePausedState) Bool() *bool

type PipelinesDB

type PipelinesDB interface {
	GetAllPublicPipelines() ([]SavedPipeline, error)
}

type ReplicationIdentifier

type ReplicationIdentifier struct {
	ReplicatedVolumeHandle string
}

func (ReplicationIdentifier) String

func (i ReplicationIdentifier) String() string

type Resource

type Resource struct {
	Name string
}

type ResourceCacheIdentifier

type ResourceCacheIdentifier struct {
	ResourceVersion atc.Version
	ResourceHash    string
}

func (ResourceCacheIdentifier) String

func (i ResourceCacheIdentifier) String() string

type ResourceNotFoundError

type ResourceNotFoundError struct {
	Name string
}

func (ResourceNotFoundError) Error

func (e ResourceNotFoundError) Error() string

type ResourceTypeNotFoundError

type ResourceTypeNotFoundError struct {
	Name string
}

func (ResourceTypeNotFoundError) 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

type SQLDB

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

func NewSQL

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

func (*SQLDB) CreateContainer

func (db *SQLDB) CreateContainer(
	container Container,
	ttl time.Duration,
	maxLifetime time.Duration,
	volumeHandles []string,
) (SavedContainer, error)

func (*SQLDB) CreateDefaultTeamIfNotExists

func (db *SQLDB) CreateDefaultTeamIfNotExists() error

func (*SQLDB) CreatePipe

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

func (*SQLDB) CreateTeam

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

func (*SQLDB) DeleteBuildEventsByBuildIDs

func (db *SQLDB) DeleteBuildEventsByBuildIDs(buildIDs []int) error

func (*SQLDB) DeleteContainer

func (db *SQLDB) DeleteContainer(handle string) error

func (*SQLDB) DeleteTeamByName

func (db *SQLDB) DeleteTeamByName(teamName string) error

func (*SQLDB) FindContainerByIdentifier

func (db *SQLDB) FindContainerByIdentifier(id ContainerIdentifier) (SavedContainer, bool, error)

func (*SQLDB) FindJobContainersFromUnsuccessfulBuilds

func (db *SQLDB) FindJobContainersFromUnsuccessfulBuilds() ([]SavedContainer, error)

func (*SQLDB) FindJobIDForBuild

func (db *SQLDB) FindJobIDForBuild(buildID int) (int, bool, error)

func (*SQLDB) FindLatestSuccessfulBuildsPerJob

func (db *SQLDB) FindLatestSuccessfulBuildsPerJob() (map[int]int, error)

func (*SQLDB) GetAllPipelines

func (db *SQLDB) GetAllPipelines() ([]SavedPipeline, error)

func (*SQLDB) GetAllPublicPipelines

func (db *SQLDB) GetAllPublicPipelines() ([]SavedPipeline, error)

func (*SQLDB) GetAllStartedBuilds

func (db *SQLDB) GetAllStartedBuilds() ([]Build, error)

func (*SQLDB) GetBuildByID

func (db *SQLDB) GetBuildByID(buildID int) (Build, bool, error)

func (*SQLDB) GetContainer

func (db *SQLDB) GetContainer(handle string) (SavedContainer, bool, error)

func (*SQLDB) GetPipe

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

func (*SQLDB) GetPipelineByID

func (db *SQLDB) GetPipelineByID(pipelineID int) (SavedPipeline, error)

func (*SQLDB) GetPublicBuilds

func (db *SQLDB) GetPublicBuilds(page Page) ([]Build, Pagination, error)

func (*SQLDB) GetTaskLock

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

func (*SQLDB) GetTeams

func (db *SQLDB) GetTeams() ([]SavedTeam, error)

func (*SQLDB) GetVolumeTTL

func (db *SQLDB) GetVolumeTTL(handle string) (time.Duration, bool, error)

func (*SQLDB) GetVolumes

func (db *SQLDB) GetVolumes() ([]SavedVolume, error)

func (*SQLDB) GetVolumesByIdentifier

func (db *SQLDB) GetVolumesByIdentifier(id VolumeIdentifier) ([]SavedVolume, error)

func (*SQLDB) GetVolumesForOneOffBuildImageResources

func (db *SQLDB) GetVolumesForOneOffBuildImageResources() ([]SavedVolume, error)

func (*SQLDB) GetWorker

func (db *SQLDB) GetWorker(name string) (SavedWorker, bool, error)

func (*SQLDB) InsertVolume

func (db *SQLDB) InsertVolume(data Volume) error

func (*SQLDB) ReapContainer

func (db *SQLDB) ReapContainer(handle string) error

func (*SQLDB) ReapExpiredContainers

func (db *SQLDB) ReapExpiredContainers() error

func (*SQLDB) ReapExpiredVolumes

func (db *SQLDB) ReapExpiredVolumes() error

func (*SQLDB) ReapExpiredWorkers

func (db *SQLDB) ReapExpiredWorkers() error

func (*SQLDB) ReapVolume

func (db *SQLDB) ReapVolume(handle string) error

func (*SQLDB) SaveWorker

func (db *SQLDB) SaveWorker(info WorkerInfo, ttl time.Duration) (SavedWorker, error)

func (*SQLDB) SetVolumeTTL

func (db *SQLDB) SetVolumeTTL(handle string, ttl time.Duration) error

func (*SQLDB) SetVolumeTTLAndSizeInBytes

func (db *SQLDB) SetVolumeTTLAndSizeInBytes(handle string, ttl time.Duration, sizeInBytes int64) error

func (*SQLDB) UpdateExpiresAtOnContainer

func (db *SQLDB) UpdateExpiresAtOnContainer(handle string, ttl time.Duration) error

func (*SQLDB) Workers

func (db *SQLDB) Workers() ([]SavedWorker, error)

type SavedContainer

type SavedContainer struct {
	Container

	TTL       time.Duration
	ExpiresIn time.Duration
	ID        int
}

type SavedJob

type SavedJob struct {
	ID                 int
	Paused             bool
	PipelineName       string
	FirstLoggedBuildID int
	TeamID             int
	Config             atc.JobConfig
	Job
}

type SavedPipeline

type SavedPipeline struct {
	ID       int
	Paused   bool
	Public   bool
	TeamID   int
	TeamName string

	Pipeline
}

type SavedResource

type SavedResource struct {
	ID           int
	CheckError   error
	Paused       bool
	PipelineName string
	Config       atc.ResourceConfig
	Resource
}

func (SavedResource) FailingToCheck

func (r SavedResource) FailingToCheck() bool

type SavedResourceType

type SavedResourceType struct {
	ID      int
	Name    string
	Type    string
	Version Version
	Config  atc.ResourceType
}

type SavedTeam

type SavedTeam struct {
	ID int
	Team
}

type SavedVersionedResource

type SavedVersionedResource struct {
	ID int

	Enabled bool

	ModifiedTime time.Time

	VersionedResource

	CheckOrder int
}

type SavedVersionedResources

type SavedVersionedResources []SavedVersionedResource

type SavedVolume

type SavedVolume struct {
	Volume

	ID        int
	ExpiresIn time.Duration
}

type SavedWorker

type SavedWorker struct {
	WorkerInfo

	TeamName  string
	ExpiresIn time.Duration
}

type Status

type Status string
const (
	StatusPending   Status = "pending"
	StatusStarted   Status = "started"
	StatusAborted   Status = "aborted"
	StatusSucceeded Status = "succeeded"
	StatusFailed    Status = "failed"
	StatusErrored   Status = "errored"
)

type Team

type Team struct {
	Name  string
	Admin bool

	BasicAuth    *BasicAuth    `json:"basic_auth"`
	GitHubAuth   *GitHubAuth   `json:"github_auth"`
	UAAAuth      *UAAAuth      `json:"uaa_auth"`
	GenericOAuth *GenericOAuth `json:"genericoauth_auth"`
}

func (Team) IsAuthConfigured

func (t Team) IsAuthConfigured() bool

type TeamDB

type TeamDB interface {
	GetPipelines() ([]SavedPipeline, error)
	GetPublicPipelines() ([]SavedPipeline, error)
	GetPrivateAndAllPublicPipelines() ([]SavedPipeline, error)

	GetPipelineByName(pipelineName string) (SavedPipeline, bool, error)

	OrderPipelines([]string) error

	GetTeam() (SavedTeam, bool, error)
	UpdateBasicAuth(basicAuth *BasicAuth) (SavedTeam, error)
	UpdateGitHubAuth(gitHubAuth *GitHubAuth) (SavedTeam, error)
	UpdateUAAAuth(uaaAuth *UAAAuth) (SavedTeam, error)
	UpdateGenericOAuth(genericOAuth *GenericOAuth) (SavedTeam, error)

	GetConfig(pipelineName string) (atc.Config, atc.RawConfig, ConfigVersion, error)
	SaveConfig(string, atc.Config, ConfigVersion, PipelinePausedState) (SavedPipeline, bool, error)

	CreateOneOffBuild() (Build, error)
	GetPrivateAndPublicBuilds(page Page) ([]Build, Pagination, error)

	Workers() ([]SavedWorker, error)
	GetContainer(handle string) (SavedContainer, bool, error)
	FindContainersByDescriptors(id Container) ([]SavedContainer, error)

	GetVolumes() ([]SavedVolume, error)
}

type TeamDBFactory

type TeamDBFactory interface {
	GetTeamDB(string) TeamDB
}

func NewTeamDBFactory

func NewTeamDBFactory(conn Conn, bus *notificationsBus, lockFactory 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
}

type UAAAuth

type UAAAuth struct {
	ClientID     string   `json:"client_id"`
	ClientSecret string   `json:"client_secret"`
	AuthURL      string   `json:"auth_url"`
	TokenURL     string   `json:"token_url"`
	CFSpaces     []string `json:"cf_spaces"`
	CFURL        string   `json:"cf_url"`
	CFCACert     string   `json:"cf_ca_cert"`
}

type Version

type Version map[string]string

type VersionedResource

type VersionedResource struct {
	Resource   string
	Type       string
	Version    Version
	Metadata   []MetadataField
	PipelineID int
}

type Volume

type Volume struct {
	Handle       string
	WorkerName   string
	TeamID       int
	ContainerTTL *time.Duration
	TTL          time.Duration
	SizeInBytes  int64
	Identifier   VolumeIdentifier
}

type VolumeIdentifier

type VolumeIdentifier struct {
	ResourceCache *ResourceCacheIdentifier
	COW           *COWIdentifier
	Output        *OutputIdentifier
	Import        *ImportIdentifier
	Replication   *ReplicationIdentifier
}

pls gib algebraic data types

func (VolumeIdentifier) String

func (i VolumeIdentifier) String() string

func (VolumeIdentifier) Type

func (i VolumeIdentifier) Type() string

type WorkerInfo

type WorkerInfo struct {
	GardenAddr      string
	BaggageclaimURL string
	HTTPProxyURL    string
	HTTPSProxyURL   string
	NoProxy         string

	ActiveContainers int
	ResourceTypes    []atc.WorkerResourceType
	Platform         string
	Tags             []string
	TeamID           int
	Name             string
	StartTime        int64
}

Directories

Path Synopsis
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