Documentation
¶
Index ¶
- Constants
- Variables
- func Close(c io.Closer)
- func NewArtifactLifecycle(conn Conn) *artifactLifecycle
- func NewCheckLifecycle(conn Conn) *checkLifecycle
- func NewCheckableCounter(conn Conn) *checkableCounter
- func NewClock() clock
- func NewNotificationsBus(listener Listener, executor Executor) *notificationsBus
- func Rollback(tx Tx)
- func SetupConnectionRetryingDriver(delegateDriverName string, sqlDataSource string, newDriverName string)
- type AccessToken
- type AccessTokenFactory
- type AccessTokenLifecycle
- type AlgorithmInput
- type AlgorithmOutput
- type AlgorithmVersion
- type BaseResourceType
- type BaseResourceTypeNotFoundError
- type Build
- type BuildCursor
- type BuildFactory
- type BuildInput
- type BuildOutput
- type BuildPreparation
- type BuildPreparationStatus
- type BuildStatus
- type Cause
- type Check
- type CheckFactory
- type CheckLifecycle
- type CheckMetadata
- type CheckStatus
- type Checkable
- type Claims
- type Clock
- type Component
- type ComponentFactory
- type ConfigVersion
- type Conn
- type ConnectionSession
- type ConnectionTracker
- type Container
- type ContainerMetadata
- type ContainerOwner
- func NewBuildStepContainerOwner(buildID int, planID atc.PlanID, teamID int) ContainerOwner
- func NewImageCheckContainerOwner(container CreatingContainer, teamID int) ContainerOwner
- func NewImageGetContainerOwner(container CreatingContainer, teamID int) ContainerOwner
- func NewResourceConfigCheckSessionContainerOwner(resourceConfigID int, baseResourceTypeID int, expiries ContainerOwnerExpiries) ContainerOwner
- type ContainerOwnerDisappearedError
- type ContainerOwnerExpiries
- type ContainerRepository
- type ContainerState
- type ContainerType
- type CreatedContainer
- type CreatedVolume
- type CreatingContainer
- type CreatingVolume
- type DestroyingContainer
- type DestroyingVolume
- type ErrCustomResourceTypeVersionNotFound
- type ErrResourceNotFound
- type ErrVolumeMarkCreatedFailed
- type ErrVolumeMarkStateFailed
- type EventSource
- type Executor
- type FailedContainer
- type FailedVolume
- type FederatedClaims
- type FirstLoggedBuildIDDecreasedError
- type InputConfig
- type InputConfigs
- type InputMapping
- type InputResult
- type InputVersionEmptyError
- type Job
- type JobFactory
- type JobSet
- type Jobs
- type Listener
- type MissingInputReasons
- type NonOneRowAffectedError
- type NotificationsBus
- type Notifier
- type Page
- type PaginatedBuilds
- type Pagination
- type PinnedVersionNotFound
- type Pipe
- type Pipeline
- type PipelineFactory
- type PipelineLifecycle
- type PipelineRef
- type ResolutionFailure
- type Resource
- type ResourceCacheDescriptor
- type ResourceCacheFactory
- type ResourceCacheLifecycle
- type ResourceCacheUser
- type ResourceConfig
- type ResourceConfigCheckSessionLifecycle
- type ResourceConfigDescriptor
- type ResourceConfigFactory
- type ResourceConfigMetadataField
- type ResourceConfigMetadataFields
- type ResourceConfigScope
- type ResourceConfigVersion
- type ResourceConfigVersions
- type ResourceFactory
- type ResourceNotFoundError
- type ResourceNotFoundInPipeline
- type ResourceType
- type ResourceTypeNotFoundError
- type ResourceTypes
- type ResourceVersion
- type Resources
- type SchedulerJob
- type SchedulerJobs
- type SchedulerResource
- type SchedulerResources
- type SpanContext
- type TaskCacheFactory
- type Team
- type TeamFactory
- type Tx
- type UpdateName
- type UsedBaseResourceType
- type UsedResourceCache
- type UsedTaskCache
- type UsedWorkerBaseResourceType
- type UsedWorkerResourceCache
- type UsedWorkerResourceCerts
- type UsedWorkerResourceType
- type UsedWorkerTaskCache
- type User
- type UserFactory
- type Version
- type VersionsDB
- func (versions VersionsDB) FindVersionOfResource(ctx context.Context, resourceID int, v atc.Version) (ResourceVersion, bool, error)
- func (versions VersionsDB) IsFirstOccurrence(ctx context.Context, jobID int, inputName string, versionMD5 ResourceVersion, ...) (bool, error)
- func (versions VersionsDB) LatestBuildPipes(ctx context.Context, buildID int) (map[int]BuildCursor, error)
- func (versions VersionsDB) LatestBuildUsingLatestVersion(ctx context.Context, jobID int, resourceID int) (int, bool, error)
- func (versions VersionsDB) LatestVersionOfResource(ctx context.Context, resourceID int) (ResourceVersion, bool, error)
- func (versions VersionsDB) NextEveryVersion(ctx context.Context, jobID int, resourceID int) (ResourceVersion, bool, bool, error)
- func (versions VersionsDB) SuccessfulBuildOutputs(ctx context.Context, buildID int) ([]AlgorithmVersion, error)
- func (versions VersionsDB) SuccessfulBuilds(ctx context.Context, jobID int) PaginatedBuilds
- func (versions VersionsDB) SuccessfulBuildsVersionConstrained(ctx context.Context, jobID int, constrainingCandidates map[string][]string) (PaginatedBuilds, error)
- func (versions VersionsDB) UnusedBuilds(ctx context.Context, jobID int, lastUsedBuild BuildCursor) (PaginatedBuilds, error)
- func (versions VersionsDB) UnusedBuildsVersionConstrained(ctx context.Context, jobID int, lastUsedBuild BuildCursor, ...) (PaginatedBuilds, error)
- func (versions VersionsDB) VersionExists(ctx context.Context, resourceID int, versionMD5 ResourceVersion) (bool, error)
- func (versions VersionsDB) VersionIsDisabled(ctx context.Context, resourceID int, versionMD5 ResourceVersion) (bool, error)
- type VolumeRepository
- type VolumeResourceType
- type VolumeState
- type VolumeType
- type Wall
- type Worker
- type WorkerArtifact
- type WorkerArtifactLifecycle
- type WorkerBaseResourceType
- type WorkerBaseResourceTypeFactory
- type WorkerFactory
- type WorkerLifecycle
- type WorkerResourceCache
- type WorkerResourceCerts
- type WorkerResourceType
- type WorkerState
- type WorkerTaskCache
- type WorkerTaskCacheFactory
Constants ¶
const ( NoVersionsSatisfiedPassedConstraints string = "no versions satisfy passed constraints" NoVersionsAvailable string = "no versions available" NoResourceCheckFinished string = "checking for latest available versions" )
const ( WorkerStateRunning = WorkerState("running") WorkerStateStalled = WorkerState("stalled") WorkerStateLanding = WorkerState("landing") WorkerStateLanded = WorkerState("landed") WorkerStateRetiring = WorkerState("retiring") )
const MissingBuildInput string = "input is not included in resolved candidates"
Variables ¶
var ( ErrVolumeCannotBeDestroyedWithChildrenPresent = errors.New("volume cannot be destroyed as children are present") ErrVolumeStateTransitionFailed = errors.New("could not transition volume state") ErrVolumeMissing = errors.New("volume no longer in db") ErrInvalidResourceCache = errors.New("invalid resource cache") )
var ( ErrWorkerNotPresent = errors.New("worker not present in db") ErrCannotPruneRunningWorker = errors.New("worker not stalled for pruning") )
var ErrAdoptRerunBuildHasNoInputs = errors.New("inputs not ready for build to rerun")
var ErrBuildArtifactNotFound = errors.New("build artifact not found")
var ErrBuildDisappeared = errors.New("build disappeared from db")
var ErrBuildEventStreamClosed = errors.New("build event stream closed")
var ErrBuildHasNoPipeline = errors.New("build has no pipeline")
var ErrConfigComparisonFailed = errors.New("comparison with existing config failed during save")
var ErrContainerDisappeared = errors.New("container disappeared from db")
var ErrEncryptedWithUnknownKey = errors.New("row encrypted with neither old nor new key")
var ErrEndOfBuildEventStream = errors.New("end of build event stream")
var ErrPinnedThroughConfig = errors.New("resource is pinned through config")
var ErrResourceCacheAlreadyExists = errors.New("resource-cache-already-exists")
var ErrResourceCacheDisappeared = errors.New("resource-cache-disappeared")
var ErrResourceConfigAlreadyExists = errors.New("resource config already exists")
var ErrResourceConfigDisappeared = errors.New("resource config disappeared")
var ErrResourceConfigHasNoType = errors.New("resource config has no type")
var ErrResourceConfigParentDisappeared = errors.New("resource config parent disappeared")
var ErrSetByNewerBuild = errors.New("pipeline set by a newer build")
var ErrWorkerBaseResourceTypeDisappeared = errors.New("worker base resource type disappeared")
var GlobalConnectionTracker = NewConnectionTracker()
Functions ¶
func Close ¶
Close ignores errors, and should used with defer. makes errcheck happy that those errs are captured
func NewArtifactLifecycle ¶
func NewArtifactLifecycle(conn Conn) *artifactLifecycle
func NewCheckLifecycle ¶
func NewCheckLifecycle(conn Conn) *checkLifecycle
func NewCheckableCounter ¶
func NewCheckableCounter(conn Conn) *checkableCounter
func NewNotificationsBus ¶
func Rollback ¶
func Rollback(tx Tx)
Rollback ignores errors, and should be used with defer. makes errcheck happy that those errs are captured
Types ¶
type AccessToken ¶
type AccessTokenFactory ¶
type AccessTokenFactory interface {
CreateAccessToken(token string, claims Claims) error
GetAccessToken(token string) (AccessToken, bool, error)
}
func NewAccessTokenFactory ¶
func NewAccessTokenFactory(conn Conn) AccessTokenFactory
type AccessTokenLifecycle ¶
type AccessTokenLifecycle interface {
RemoveExpiredAccessTokens(leeway time.Duration) (int, error)
}
func NewAccessTokenLifecycle ¶
func NewAccessTokenLifecycle(conn Conn) AccessTokenLifecycle
type AlgorithmInput ¶
type AlgorithmInput struct {
AlgorithmVersion
FirstOccurrence bool
}
type AlgorithmOutput ¶
type AlgorithmOutput struct {
AlgorithmVersion
InputName string
}
type AlgorithmVersion ¶
type AlgorithmVersion struct {
ResourceID int
Version ResourceVersion
}
type BaseResourceType ¶
type BaseResourceType struct {
Name string // The name of the type, e.g. 'git'.
}
BaseResourceType represents a resource type provided by workers.
It is created via worker registration. All creates are upserts.
It is removed by gc.BaseResourceTypeCollector, once there are no references to it from worker_base_resource_types.
func (BaseResourceType) Find ¶
func (brt BaseResourceType) Find(runner sq.Runner) (*UsedBaseResourceType, bool, error)
func (BaseResourceType) FindOrCreate ¶
func (brt BaseResourceType) FindOrCreate(tx Tx, unique bool) (*UsedBaseResourceType, error)
FindOrCreate looks for an existing BaseResourceType and creates it if it doesn't exist. It returns a UsedBaseResourceType.
type BaseResourceTypeNotFoundError ¶
type BaseResourceTypeNotFoundError struct {
Name string
}
func (BaseResourceTypeNotFoundError) Error ¶
func (e BaseResourceTypeNotFoundError) Error() string
type Build ¶
type Build interface {
PipelineRef
ID() int
Name() string
JobID() int
JobName() string
TeamID() int
TeamName() string
Schema() string
PrivatePlan() atc.Plan
PublicPlan() *json.RawMessage
HasPlan() bool
Status() BuildStatus
StartTime() time.Time
IsNewerThanLastCheckOf(input Resource) bool
EndTime() time.Time
ReapTime() time.Time
IsManuallyTriggered() bool
IsScheduled() bool
IsRunning() bool
IsCompleted() bool
InputsReady() bool
RerunOf() int
RerunOfName() string
RerunNumber() int
Reload() (bool, error)
ResourcesChecked() (bool, error)
AcquireTrackingLock(logger lager.Logger, interval time.Duration) (lock.Lock, bool, error)
Interceptible() (bool, error)
Preparation() (BuildPreparation, bool, error)
Start(atc.Plan) (bool, error)
Finish(BuildStatus) error
SetInterceptible(bool) error
Events(uint) (EventSource, error)
SaveEvent(event atc.Event) error
Artifacts() ([]WorkerArtifact, error)
Artifact(artifactID int) (WorkerArtifact, error)
SaveOutput(string, atc.Source, atc.VersionedResourceTypes, atc.Version, ResourceConfigMetadataFields, string, string) error
AdoptInputsAndPipes() ([]BuildInput, bool, error)
AdoptRerunInputsAndPipes() ([]BuildInput, bool, error)
Resources() ([]BuildInput, []BuildOutput, error)
SaveImageResourceVersion(UsedResourceCache) error
Delete() (bool, error)
MarkAsAborted() error
IsAborted() bool
AbortNotifier() (Notifier, error)
IsDrained() bool
SetDrained(bool) error
SpanContext() propagators.Supplier
SavePipeline(
pipelineName string,
teamId int,
config atc.Config,
from ConfigVersion,
initiallyPaused bool,
) (Pipeline, bool, error)
}
type BuildCursor ¶
func (BuildCursor) NewerBuilds ¶
func (cursor BuildCursor) NewerBuilds(idCol string) sq.Sqlizer
func (BuildCursor) OlderBuilds ¶
func (cursor BuildCursor) OlderBuilds(idCol string) sq.Sqlizer
type BuildFactory ¶
type BuildFactory interface {
Build(int) (Build, bool, error)
VisibleBuilds([]string, Page) ([]Build, Pagination, error)
AllBuilds(Page) ([]Build, Pagination, error)
PublicBuilds(Page) ([]Build, Pagination, error)
GetAllStartedBuilds() ([]Build, error)
GetDrainableBuilds() ([]Build, error)
// TODO: move to BuildLifecycle, new interface (see WorkerLifecycle)
MarkNonInterceptibleBuilds() error
}
func NewBuildFactory ¶
func NewBuildFactory(conn Conn, lockFactory lock.LockFactory, oneOffGracePeriod time.Duration, failedGracePeriod time.Duration) BuildFactory
type BuildInput ¶
type BuildInput struct {
Name string
Version atc.Version
ResourceID int
FirstOccurrence bool
ResolveError string
Context SpanContext
}
func (BuildInput) SpanContext ¶
func (bi BuildInput) SpanContext() propagators.Supplier
type BuildOutput ¶
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 ( BuildPreparationStatusBlocking BuildPreparationStatus = "blocking" BuildPreparationStatusNotBlocking BuildPreparationStatus = "not_blocking" )
type BuildStatus ¶
type BuildStatus string
const ( BuildStatusPending BuildStatus = "pending" BuildStatusStarted BuildStatus = "started" BuildStatusAborted BuildStatus = "aborted" BuildStatusSucceeded BuildStatus = "succeeded" BuildStatusFailed BuildStatus = "failed" BuildStatusErrored BuildStatus = "errored" )
type Check ¶
type Check interface {
PipelineRef
ID() int
TeamID() int
TeamName() string
ResourceConfigScopeID() int
ResourceConfigID() int
BaseResourceTypeID() int
Schema() string
Plan() atc.Plan
CreateTime() time.Time
StartTime() time.Time
EndTime() time.Time
Status() CheckStatus
CheckError() error
ManuallyTriggered() bool
Start() error
Finish() error
FinishWithError(err error) error
SaveVersions(SpanContext, []atc.Version) error
AllCheckables() ([]Checkable, error)
AcquireTrackingLock(lager.Logger) (lock.Lock, bool, error)
Reload() (bool, error)
SpanContext() propagators.Supplier
}
type CheckFactory ¶
type CheckFactory interface {
Check(int) (Check, bool, error)
StartedChecks() ([]Check, error)
CreateCheck(int, bool, atc.Plan, CheckMetadata, SpanContext) (Check, bool, error)
TryCreateCheck(context.Context, Checkable, ResourceTypes, atc.Version, bool) (Check, bool, error)
Resources() ([]Resource, error)
ResourceTypes() ([]ResourceType, error)
AcquireScanningLock(lager.Logger) (lock.Lock, bool, error)
NotifyChecker() error
}
func NewCheckFactory ¶
func NewCheckFactory( conn Conn, lockFactory lock.LockFactory, secrets creds.Secrets, varSourcePool creds.VarSourcePool, defaultCheckTimeout time.Duration, ) CheckFactory
type CheckLifecycle ¶
type CheckMetadata ¶
type CheckStatus ¶
type CheckStatus string
const ( CheckStatusStarted CheckStatus = "started" CheckStatusSucceeded CheckStatus = "succeeded" CheckStatusErrored CheckStatus = "errored" )
type Checkable ¶
type Checkable interface {
PipelineRef
Name() string
TeamID() int
ResourceConfigScopeID() int
TeamName() string
Type() string
Source() atc.Source
Tags() atc.Tags
CheckEvery() string
CheckTimeout() string
LastCheckEndTime() time.Time
CurrentPinnedVersion() atc.Version
HasWebhook() bool
SetResourceConfig(
atc.Source,
atc.VersionedResourceTypes,
) (ResourceConfigScope, error)
SetCheckSetupError(error) error
}
type Claims ¶
type Claims struct {
jwt.Claims
FederatedClaims `json:"federated_claims"`
RawClaims map[string]interface{} `json:"-"`
}
func (Claims) MarshalJSON ¶
func (*Claims) UnmarshalJSON ¶
type ComponentFactory ¶
type ComponentFactory interface {
CreateOrUpdate(atc.Component) (Component, error)
Find(string) (Component, bool, error)
}
func NewComponentFactory ¶
func NewComponentFactory(conn Conn) ComponentFactory
type ConfigVersion ¶
type ConfigVersion int
ConfigVersion is a sequence identifier used for compare-and-swap.
type Conn ¶
type Conn interface {
Bus() NotificationsBus
EncryptionStrategy() encryption.Strategy
Ping() error
Driver() driver.Driver
Begin() (Tx, error)
Exec(string, ...interface{}) (sql.Result, error)
Prepare(string) (*sql.Stmt, error)
Query(string, ...interface{}) (*sql.Rows, error)
QueryRow(string, ...interface{}) squirrel.RowScanner
BeginTx(context.Context, *sql.TxOptions) (Tx, error)
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) squirrel.RowScanner
SetMaxIdleConns(int)
SetMaxOpenConns(int)
Stats() sql.DBStats
Close() error
Name() string
}
func Log ¶
Log returns a wrapper of DB connection which contains a wraper of DB transactions so all queries could be logged by givin logger
func Open ¶
func Open(logger lager.Logger, sqlDriver string, sqlDataSource string, newKey *encryption.Key, oldKey *encryption.Key, connectionName string, lockFactory lock.LockFactory) (Conn, error)
type ConnectionSession ¶
type ConnectionSession struct {
// contains filtered or unexported fields
}
func (*ConnectionSession) Release ¶
func (session *ConnectionSession) Release()
type ConnectionTracker ¶
type ConnectionTracker struct {
// contains filtered or unexported fields
}
func NewConnectionTracker ¶
func NewConnectionTracker() *ConnectionTracker
func (*ConnectionTracker) Current ¶
func (tracker *ConnectionTracker) Current() []string
func (*ConnectionTracker) Track ¶
func (tracker *ConnectionTracker) Track() *ConnectionSession
type Container ¶
type Container interface {
ID() int
State() string
Handle() string
WorkerName() string
Metadata() ContainerMetadata
}
type ContainerMetadata ¶
type ContainerMetadata struct {
Type ContainerType
StepName string
Attempt string
WorkingDirectory string
User string
PipelineID int
JobID int
BuildID int
PipelineName string
JobName string
BuildName string
}
func (ContainerMetadata) SQLMap ¶
func (metadata ContainerMetadata) SQLMap() map[string]interface{}
func (*ContainerMetadata) ScanTargets ¶
func (metadata *ContainerMetadata) ScanTargets() []interface{}
type ContainerOwner ¶
type ContainerOwner interface {
Find(conn Conn) (sq.Eq, bool, error)
Create(tx Tx, workerName string) (map[string]interface{}, error)
}
ContainerOwner designates the data the container should reference that identifies its lifecycle. When the owner goes away, the container should be garbage collected.
func NewBuildStepContainerOwner ¶
func NewBuildStepContainerOwner( buildID int, planID atc.PlanID, teamID int, ) ContainerOwner
NewBuildStepContainerOwner references a step within a build. When the build becomes non-interceptible or disappears, the container can be removed.
func NewImageCheckContainerOwner ¶
func NewImageCheckContainerOwner( container CreatingContainer, teamID int, ) ContainerOwner
NewImageCheckContainerOwner references a container whose image resource this container is checking. When the referenced container transitions to another state, or disappears, the container can be removed.
func NewImageGetContainerOwner ¶
func NewImageGetContainerOwner( container CreatingContainer, teamID int, ) ContainerOwner
NewImageGetContainerOwner references a container whose image resource this container is fetching. When the referenced container transitions to another state, or disappears, the container can be removed.
func NewResourceConfigCheckSessionContainerOwner ¶
func NewResourceConfigCheckSessionContainerOwner( resourceConfigID int, baseResourceTypeID int, expiries ContainerOwnerExpiries, ) ContainerOwner
NewResourceConfigCheckSessionContainerOwner references a resource config and worker base resource type, with an expiry. When the resource config or worker base resource type disappear, or the expiry is reached, the container can be removed.
type ContainerOwnerDisappearedError ¶
type ContainerOwnerDisappearedError struct {
// contains filtered or unexported fields
}
func (ContainerOwnerDisappearedError) Error ¶
func (e ContainerOwnerDisappearedError) Error() string
type ContainerOwnerExpiries ¶
type ContainerRepository ¶
type ContainerRepository interface {
FindOrphanedContainers() ([]CreatingContainer, []CreatedContainer, []DestroyingContainer, error)
DestroyFailedContainers() (int, error)
FindDestroyingContainers(workerName string) ([]string, error)
RemoveDestroyingContainers(workerName string, currentHandles []string) (int, error)
UpdateContainersMissingSince(workerName string, handles []string) error
RemoveMissingContainers(time.Duration) (int, error)
DestroyUnknownContainers(workerName string, reportedHandles []string) (int, error)
}
func NewContainerRepository ¶
func NewContainerRepository(conn Conn) ContainerRepository
type ContainerState ¶
type ContainerState string
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)
type CreatedContainer ¶
type CreatedVolume ¶
type CreatedVolume interface {
Handle() string
Path() string
Type() VolumeType
TeamID() int
WorkerArtifactID() int
CreateChildForContainer(CreatingContainer, string) (CreatingVolume, error)
Destroying() (DestroyingVolume, error)
WorkerName() string
InitializeResourceCache(UsedResourceCache) error
GetResourceCacheID() int
InitializeArtifact(name string, buildID int) (WorkerArtifact, error)
InitializeTaskCache(jobID int, stepName string, path string) error
ContainerHandle() string
ParentHandle() string
ResourceType() (*VolumeResourceType, error)
BaseResourceType() (*UsedWorkerBaseResourceType, error)
TaskIdentifier() (string, string, string, error)
}
TODO-Later Consider separating CORE & Runtime concerns by breaking this abstraction up.
type CreatingContainer ¶
type CreatingContainer interface {
Container
Created() (CreatedContainer, error)
Failed() (FailedContainer, error)
}
type CreatingVolume ¶
type CreatingVolume interface {
Handle() string
ID() int
Created() (CreatedVolume, error)
Failed() (FailedVolume, error)
}
type DestroyingContainer ¶
type DestroyingVolume ¶
type ErrCustomResourceTypeVersionNotFound ¶
type ErrCustomResourceTypeVersionNotFound struct {
Name string
}
func (ErrCustomResourceTypeVersionNotFound) Error ¶
func (e ErrCustomResourceTypeVersionNotFound) Error() string
type ErrResourceNotFound ¶
type ErrResourceNotFound struct {
Name string
}
func (ErrResourceNotFound) Error ¶
func (e ErrResourceNotFound) Error() string
type ErrVolumeMarkCreatedFailed ¶
type ErrVolumeMarkCreatedFailed struct {
Handle string
}
func (ErrVolumeMarkCreatedFailed) Error ¶
func (e ErrVolumeMarkCreatedFailed) Error() string
type ErrVolumeMarkStateFailed ¶
type ErrVolumeMarkStateFailed struct {
State VolumeState
}
func (ErrVolumeMarkStateFailed) Error ¶
func (e ErrVolumeMarkStateFailed) Error() string
type FailedContainer ¶
type FailedVolume ¶
type FederatedClaims ¶
type FirstLoggedBuildIDDecreasedError ¶
func (FirstLoggedBuildIDDecreasedError) Error ¶
func (e FirstLoggedBuildIDDecreasedError) Error() string
type InputConfig ¶
type InputConfigs ¶
type InputConfigs []InputConfig
func (InputConfigs) String ¶
func (cfgs InputConfigs) String() string
type InputMapping ¶
type InputMapping map[string]InputResult
type InputResult ¶
type InputResult struct {
Input *AlgorithmInput
PassedBuildIDs []int
ResolveError ResolutionFailure
}
type InputVersionEmptyError ¶
type InputVersionEmptyError struct {
InputName string
}
func (InputVersionEmptyError) Error ¶
func (e InputVersionEmptyError) Error() string
type Job ¶
type Job interface {
PipelineRef
ID() int
Name() string
Paused() bool
FirstLoggedBuildID() int
TeamID() int
TeamName() string
Tags() []string
Public() bool
ScheduleRequestedTime() time.Time
MaxInFlight() int
DisableManualTrigger() bool
Config() (atc.JobConfig, error)
Inputs() ([]atc.JobInput, error)
Outputs() ([]atc.JobOutput, error)
AlgorithmInputs() (InputConfigs, error)
Reload() (bool, error)
Pause() error
Unpause() error
ScheduleBuild(Build) (bool, error)
CreateBuild() (Build, error)
RerunBuild(Build) (Build, error)
RequestSchedule() error
UpdateLastScheduled(time.Time) error
Builds(page Page) ([]Build, Pagination, error)
BuildsWithTime(page Page) ([]Build, Pagination, error)
Build(name string) (Build, bool, error)
FinishedAndNextBuild() (Build, Build, error)
UpdateFirstLoggedBuildID(newFirstLoggedBuildID int) error
EnsurePendingBuildExists(context.Context) error
GetPendingBuilds() ([]Build, error)
GetNextBuildInputs() ([]BuildInput, error)
GetFullNextBuildInputs() ([]BuildInput, bool, error)
SaveNextInputMapping(inputMapping InputMapping, inputsDetermined bool) error
ClearTaskCache(string, string) (int64, error)
AcquireSchedulingLock(lager.Logger) (lock.Lock, bool, error)
SetHasNewInputs(bool) error
HasNewInputs() bool
}
type JobFactory ¶
type JobFactory interface {
VisibleJobs([]string) (atc.Dashboard, error)
AllActiveJobs() (atc.Dashboard, error)
JobsToSchedule() (SchedulerJobs, error)
}
XXX: This job factory object is not really a job factory anymore. It is holding the responsibility for two very different things: constructing a dashboard object and also a scheduler job object. Figure out what this is trying to encapsulate or considering splitting this out!
func NewJobFactory ¶
func NewJobFactory(conn Conn, lockFactory lock.LockFactory) JobFactory
type MissingInputReasons ¶
func (MissingInputReasons) RegisterMissingInput ¶
func (m MissingInputReasons) RegisterMissingInput(inputName string)
func (MissingInputReasons) RegisterNoResourceCheckFinished ¶
func (m MissingInputReasons) RegisterNoResourceCheckFinished(inputName string)
func (MissingInputReasons) RegisterResolveError ¶
func (m MissingInputReasons) RegisterResolveError(inputName string, resolveErr string)
type NonOneRowAffectedError ¶
type NonOneRowAffectedError struct {
RowsAffected int64
}
func (NonOneRowAffectedError) Error ¶
func (err NonOneRowAffectedError) Error() string
type NotificationsBus ¶
type PaginatedBuilds ¶
type PaginatedBuilds struct {
// contains filtered or unexported fields
}
func (*PaginatedBuilds) HasNext ¶
func (bs *PaginatedBuilds) HasNext() bool
type Pagination ¶
type PinnedVersionNotFound ¶
func (PinnedVersionNotFound) String ¶
func (p PinnedVersionNotFound) String() ResolutionFailure
type Pipeline ¶
type Pipeline interface {
ID() int
Name() string
TeamID() int
TeamName() string
ParentJobID() int
ParentBuildID() int
Groups() atc.GroupConfigs
VarSources() atc.VarSourceConfigs
ConfigVersion() ConfigVersion
Config() (atc.Config, error)
Public() bool
Paused() bool
Archived() bool
LastUpdated() time.Time
CheckPaused() (bool, error)
Reload() (bool, error)
Causality(versionedResourceID int) ([]Cause, error)
ResourceVersion(resourceConfigVersionID int) (atc.ResourceVersion, bool, error)
GetBuildsWithVersionAsInput(int, int) ([]Build, error)
GetBuildsWithVersionAsOutput(int, int) ([]Build, error)
Builds(page Page) ([]Build, Pagination, error)
CreateOneOffBuild() (Build, error)
CreateStartedBuild(plan atc.Plan) (Build, error)
BuildsWithTime(page Page) ([]Build, Pagination, error)
DeleteBuildEventsByBuildIDs(buildIDs []int) error
LoadDebugVersionsDB() (*atc.DebugVersionsDB, error)
Resource(name string) (Resource, bool, error)
ResourceByID(id int) (Resource, bool, error)
Resources() (Resources, error)
ResourceTypes() (ResourceTypes, error)
ResourceType(name string) (ResourceType, bool, error)
ResourceTypeByID(id int) (ResourceType, bool, error)
Job(name string) (Job, bool, error)
Jobs() (Jobs, error)
Dashboard() (atc.Dashboard, error)
Expose() error
Hide() error
Pause() error
Unpause() error
Archive() error
Destroy() error
Rename(string) error
Variables(lager.Logger, creds.Secrets, creds.VarSourcePool) (vars.Variables, error)
SetParentIDs(jobID, buildID int) error
}
type PipelineFactory ¶
type PipelineFactory interface {
VisiblePipelines([]string) ([]Pipeline, error)
AllPipelines() ([]Pipeline, error)
PipelinesToSchedule() ([]Pipeline, error)
}
func NewPipelineFactory ¶
func NewPipelineFactory(conn Conn, lockFactory lock.LockFactory) PipelineFactory
type PipelineLifecycle ¶
type PipelineLifecycle interface {
ArchiveAbandonedPipelines() error
}
func NewPipelineLifecycle ¶
func NewPipelineLifecycle(conn Conn, lockFactory lock.LockFactory) PipelineLifecycle
type PipelineRef ¶
type PipelineRef interface {
PipelineID() int
PipelineName() string
Pipeline() (Pipeline, bool, error)
}
A lot of struct refer to a pipeline. This is a helper interface that should embedded in those interfaces that need to refer to a pipeline. Accordingly, implementations of those interfaces should embed "pipelineRef".
func NewPipelineRef ¶
func NewPipelineRef(id int, name string, conn Conn, lockFactory lock.LockFactory) PipelineRef
type ResolutionFailure ¶
type ResolutionFailure string
const ( LatestVersionNotFound ResolutionFailure = "latest version of resource not found" VersionNotFound ResolutionFailure = "version of resource not found" NoSatisfiableBuilds ResolutionFailure = "no satisfiable builds from passed jobs found for set of inputs" )
type Resource ¶
type Resource interface {
PipelineRef
ID() int
Name() string
Public() bool
TeamID() int
TeamName() string
Type() string
Source() atc.Source
CheckEvery() string
CheckTimeout() string
LastCheckStartTime() time.Time
LastCheckEndTime() time.Time
Tags() atc.Tags
CheckSetupError() error
CheckError() error
WebhookToken() string
Config() atc.ResourceConfig
ConfigPinnedVersion() atc.Version
APIPinnedVersion() atc.Version
PinComment() string
SetPinComment(string) error
ResourceConfigID() int
ResourceConfigScopeID() int
Icon() string
HasWebhook() bool
CurrentPinnedVersion() atc.Version
ResourceConfigVersionID(atc.Version) (int, bool, error)
Versions(page Page, versionFilter atc.Version) ([]atc.ResourceVersion, Pagination, bool, error)
SaveUncheckedVersion(atc.Version, ResourceConfigMetadataFields, ResourceConfig, atc.VersionedResourceTypes) (bool, error)
UpdateMetadata(atc.Version, ResourceConfigMetadataFields) (bool, error)
EnableVersion(rcvID int) error
DisableVersion(rcvID int) error
PinVersion(rcvID int) (bool, error)
UnpinVersion() error
SetResourceConfig(atc.Source, atc.VersionedResourceTypes) (ResourceConfigScope, error)
SetCheckSetupError(error) error
NotifyScan() error
Reload() (bool, error)
}
type ResourceCacheDescriptor ¶
type ResourceCacheDescriptor struct {
ResourceConfigDescriptor ResourceConfigDescriptor // The resource configuration.
Version atc.Version // The version of the resource.
Params atc.Params // The params used when fetching the version.
}
ResourceCache represents an instance of a ResourceConfig's version.
A ResourceCache is created by a `get`, an `image_resource`, or a resource type in a pipeline.
ResourceCaches are garbage-collected by gc.ResourceCacheCollector.
type ResourceCacheFactory ¶
type ResourceCacheFactory interface {
FindOrCreateResourceCache(
resourceCacheUser ResourceCacheUser,
resourceTypeName string,
version atc.Version,
source atc.Source,
params atc.Params,
resourceTypes atc.VersionedResourceTypes,
) (UsedResourceCache, error)
// changing resource cache to interface to allow updates on object is not feasible.
// Since we need to pass it recursively in ResourceConfig.
// Also, metadata will be available to us before we create resource cache so this
// method can be removed at that point. See https://github.com/chenbh/concourse/v6/issues/534
UpdateResourceCacheMetadata(UsedResourceCache, []atc.MetadataField) error
ResourceCacheMetadata(UsedResourceCache) (ResourceConfigMetadataFields, error)
FindResourceCacheByID(id int) (UsedResourceCache, bool, error)
}
func NewResourceCacheFactory ¶
func NewResourceCacheFactory(conn Conn, lockFactory lock.LockFactory) ResourceCacheFactory
type ResourceCacheLifecycle ¶
type ResourceCacheLifecycle interface {
CleanUsesForFinishedBuilds(lager.Logger) error
CleanBuildImageResourceCaches(lager.Logger) error
CleanUpInvalidCaches(lager.Logger) error
}
func NewResourceCacheLifecycle ¶
func NewResourceCacheLifecycle(conn Conn) ResourceCacheLifecycle
type ResourceCacheUser ¶
type ResourceCacheUser interface {
SQLMap() map[string]interface{}
}
ResourceCacheUser designates the column to set in the resource_cache_users table.
func ForBuild ¶
func ForBuild(id int) ResourceCacheUser
func ForContainer ¶
func ForContainer(id int) ResourceCacheUser
type ResourceConfig ¶
type ResourceConfig interface {
ID() int
CreatedByResourceCache() UsedResourceCache
CreatedByBaseResourceType() *UsedBaseResourceType
OriginBaseResourceType() *UsedBaseResourceType
FindResourceConfigScopeByID(int, Resource) (ResourceConfigScope, bool, error)
}
type ResourceConfigCheckSessionLifecycle ¶
type ResourceConfigCheckSessionLifecycle interface {
CleanInactiveResourceConfigCheckSessions() error
CleanExpiredResourceConfigCheckSessions() error
}
func NewResourceConfigCheckSessionLifecycle ¶
func NewResourceConfigCheckSessionLifecycle(conn Conn) ResourceConfigCheckSessionLifecycle
type ResourceConfigDescriptor ¶
type ResourceConfigDescriptor struct {
// A resource type provided by a resource.
CreatedByResourceCache *ResourceCacheDescriptor
// A resource type provided by a worker.
CreatedByBaseResourceType *BaseResourceType
// The resource's source configuration.
Source atc.Source
}
ResourceConfig represents a resource type and config source.
Resources in a pipeline, resource types in a pipeline, and `image_resource` fields in a task all result in a reference to a ResourceConfig.
ResourceConfigs are garbage-collected by gc.ResourceConfigCollector.
type ResourceConfigFactory ¶
type ResourceConfigFactory interface {
FindOrCreateResourceConfig(
resourceType string,
source atc.Source,
resourceTypes atc.VersionedResourceTypes,
) (ResourceConfig, error)
FindResourceConfigByID(int) (ResourceConfig, bool, error)
CleanUnreferencedConfigs() error
}
func NewResourceConfigFactory ¶
func NewResourceConfigFactory(conn Conn, lockFactory lock.LockFactory) ResourceConfigFactory
type ResourceConfigMetadataFields ¶
type ResourceConfigMetadataFields []ResourceConfigMetadataField
func NewResourceConfigMetadataFields ¶
func NewResourceConfigMetadataFields(atcm []atc.MetadataField) ResourceConfigMetadataFields
func (ResourceConfigMetadataFields) ToATCMetadata ¶
func (rmf ResourceConfigMetadataFields) ToATCMetadata() []atc.MetadataField
type ResourceConfigScope ¶
type ResourceConfigScope interface {
ID() int
Resource() Resource
ResourceConfig() ResourceConfig
CheckError() error
SaveVersions(SpanContext, []atc.Version) error
FindVersion(atc.Version) (ResourceConfigVersion, bool, error)
LatestVersion() (ResourceConfigVersion, bool, error)
SetCheckError(error) error
AcquireResourceCheckingLock(
logger lager.Logger,
) (lock.Lock, bool, error)
UpdateLastCheckStartTime(
interval time.Duration,
immediate bool,
) (bool, error)
UpdateLastCheckEndTime() (bool, error)
}
ResourceConfigScope represents the relationship between a possible pipeline resource and a resource config. When a resource is specified to have a unique version history either through its base resource type or its custom resource type, it results in its generated resource config to be scoped to the resource. This relationship is translated into its row in the resource config scopes table to have both the resource id and resource config id populated. When a resource has a shared version history, its resource config is not scoped to the (or any) resource and its row in the resource config scopes table will have the resource config id populated but a NULL value for the resource id. Resource versions will therefore be directly dependent on a resource config scope.
type ResourceConfigVersion ¶
type ResourceConfigVersion interface {
ID() int
Version() Version
Metadata() ResourceConfigMetadataFields
CheckOrder() int
ResourceConfigScope() ResourceConfigScope
SpanContext() propagators.Supplier
Reload() (bool, error)
}
type ResourceConfigVersions ¶
type ResourceConfigVersions []ResourceConfigVersion
type ResourceFactory ¶
type ResourceFactory interface {
Resource(int) (Resource, bool, error)
VisibleResources([]string) ([]Resource, error)
AllResources() ([]Resource, error)
}
func NewResourceFactory ¶
func NewResourceFactory(conn Conn, lockFactory lock.LockFactory) ResourceFactory
type ResourceNotFoundError ¶
type ResourceNotFoundError struct {
ID int
}
func (ResourceNotFoundError) Error ¶
func (e ResourceNotFoundError) Error() string
type ResourceNotFoundInPipeline ¶
func (ResourceNotFoundInPipeline) Error ¶
func (r ResourceNotFoundInPipeline) Error() string
type ResourceType ¶
type ResourceType interface {
PipelineRef
ID() int
TeamID() int
TeamName() string
Name() string
Type() string
Privileged() bool
Source() atc.Source
Params() atc.Params
Tags() atc.Tags
CheckEvery() string
CheckTimeout() string
LastCheckStartTime() time.Time
LastCheckEndTime() time.Time
CheckSetupError() error
CheckError() error
UniqueVersionHistory() bool
CurrentPinnedVersion() atc.Version
ResourceConfigScopeID() int
HasWebhook() bool
SetResourceConfig(atc.Source, atc.VersionedResourceTypes) (ResourceConfigScope, error)
SetCheckSetupError(error) error
Version() atc.Version
Reload() (bool, error)
}
type ResourceTypeNotFoundError ¶
type ResourceTypeNotFoundError struct {
ID int
}
func (ResourceTypeNotFoundError) Error ¶
func (e ResourceTypeNotFoundError) Error() string
type ResourceTypes ¶
type ResourceTypes []ResourceType
func (ResourceTypes) Configs ¶
func (resourceTypes ResourceTypes) Configs() atc.ResourceTypes
func (ResourceTypes) Deserialize ¶
func (resourceTypes ResourceTypes) Deserialize() atc.VersionedResourceTypes
func (ResourceTypes) Filter ¶
func (resourceTypes ResourceTypes) Filter(checkable Checkable) ResourceTypes
func (ResourceTypes) Parent ¶
func (resourceTypes ResourceTypes) Parent(checkable Checkable) (ResourceType, bool)
type ResourceVersion ¶
type ResourceVersion string
type Resources ¶
type Resources []Resource
func (Resources) Configs ¶
func (resources Resources) Configs() atc.ResourceConfigs
type SchedulerJob ¶
type SchedulerJob struct {
Job
Resources SchedulerResources
ResourceTypes atc.VersionedResourceTypes
}
type SchedulerJobs ¶
type SchedulerJobs []SchedulerJob
type SchedulerResource ¶
type SchedulerResources ¶
type SchedulerResources []SchedulerResource
func (SchedulerResources) Lookup ¶
func (resources SchedulerResources) Lookup(name string) (SchedulerResource, bool)
type SpanContext ¶
func NewSpanContext ¶
func NewSpanContext(ctx context.Context) SpanContext
func (SpanContext) Get ¶
func (sc SpanContext) Get(key string) string
func (SpanContext) Set ¶
func (sc SpanContext) Set(key, value string)
type TaskCacheFactory ¶
type TaskCacheFactory interface {
Find(jobID int, stepName string, path string) (UsedTaskCache, bool, error)
FindOrCreate(jobID int, stepName string, path string) (UsedTaskCache, error)
}
func NewTaskCacheFactory ¶
func NewTaskCacheFactory(conn Conn) TaskCacheFactory
type Team ¶
type Team interface {
ID() int
Name() string
Admin() bool
Auth() atc.TeamAuth
Delete() error
Rename(string) error
SavePipeline(
pipelineName string,
config atc.Config,
from ConfigVersion,
initiallyPaused bool,
) (Pipeline, bool, error)
Pipeline(pipelineName string) (Pipeline, bool, error)
Pipelines() ([]Pipeline, error)
PublicPipelines() ([]Pipeline, error)
OrderPipelines([]string) error
CreateOneOffBuild() (Build, error)
CreateStartedBuild(plan atc.Plan) (Build, error)
PrivateAndPublicBuilds(Page) ([]Build, Pagination, error)
Builds(page Page) ([]Build, Pagination, error)
BuildsWithTime(page Page) ([]Build, Pagination, error)
SaveWorker(atcWorker atc.Worker, ttl time.Duration) (Worker, error)
Workers() ([]Worker, error)
FindVolumeForWorkerArtifact(int) (CreatedVolume, bool, error)
Containers() ([]Container, error)
IsCheckContainer(string) (bool, error)
IsContainerWithinTeam(string, bool) (bool, error)
FindContainerByHandle(string) (Container, bool, error)
FindCheckContainers(lager.Logger, string, string, creds.Secrets, creds.VarSourcePool) ([]Container, map[int]time.Time, error)
FindContainersByMetadata(ContainerMetadata) ([]Container, error)
FindCreatedContainerByHandle(string) (CreatedContainer, bool, error)
FindWorkerForContainer(handle string) (Worker, bool, error)
FindWorkerForVolume(handle string) (Worker, bool, error)
UpdateProviderAuth(auth atc.TeamAuth) error
}
type TeamFactory ¶
type TeamFactory interface {
CreateTeam(atc.Team) (Team, error)
FindTeam(string) (Team, bool, error)
GetTeams() ([]Team, error)
GetByID(teamID int) Team
CreateDefaultTeamIfNotExists() (Team, error)
NotifyResourceScanner() error
NotifyCacher() error
}
func NewTeamFactory ¶
func NewTeamFactory(conn Conn, lockFactory lock.LockFactory) TeamFactory
type Tx ¶
type Tx interface {
Commit() error
Exec(string, ...interface{}) (sql.Result, error)
Prepare(string) (*sql.Stmt, error)
Query(string, ...interface{}) (*sql.Rows, error)
QueryRow(string, ...interface{}) squirrel.RowScanner
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) squirrel.RowScanner
Rollback() error
Stmt(*sql.Stmt) *sql.Stmt
EncryptionStrategy() encryption.Strategy
}
type UpdateName ¶
type UsedBaseResourceType ¶
type UsedBaseResourceType struct {
ID int // The ID of the BaseResourceType.
Name string // The name of the type, e.g. 'git'.
UniqueVersionHistory bool // If set to true, will create unique version histories for each of the resources using this base resource type
}
UsedBaseResourceType is created whenever a ResourceConfig is used, either for a build, a resource in the pipeline, or a resource type in the pipeline.
So long as the UsedBaseResourceType's ID is referenced by a ResourceConfig that is in use, this guarantees that the BaseResourceType will not be removed. That is to say that its "Use" is vicarious.
type UsedResourceCache ¶
type UsedResourceCache interface {
ID() int
Version() atc.Version
ResourceConfig() ResourceConfig
Destroy(Tx) (bool, error)
BaseResourceType() *UsedBaseResourceType
}
type UsedTaskCache ¶
type UsedWorkerResourceCache ¶
type UsedWorkerResourceCache struct {
ID int
}
type UsedWorkerResourceCerts ¶
type UsedWorkerResourceCerts struct {
ID int
}
type UsedWorkerResourceType ¶
type UsedWorkerResourceType struct {
ID int
Worker Worker
UsedBaseResourceType *UsedBaseResourceType
}
type UsedWorkerTaskCache ¶
type UserFactory ¶
type UserFactory interface {
CreateOrUpdateUser(username, connector, sub string) error
GetAllUsers() ([]User, error)
GetAllUsersByLoginDate(LastLogin time.Time) ([]User, error)
}
func NewUserFactory ¶
func NewUserFactory(conn Conn) UserFactory
type VersionsDB ¶
type VersionsDB struct {
// contains filtered or unexported fields
}
func NewVersionsDB ¶
func NewVersionsDB(conn Conn, limitRows int, cache *gocache.Cache) VersionsDB
func (VersionsDB) FindVersionOfResource ¶
func (versions VersionsDB) FindVersionOfResource(ctx context.Context, resourceID int, v atc.Version) (ResourceVersion, bool, error)
func (VersionsDB) IsFirstOccurrence ¶
func (versions VersionsDB) IsFirstOccurrence(ctx context.Context, jobID int, inputName string, versionMD5 ResourceVersion, resourceId int) (bool, error)
func (VersionsDB) LatestBuildPipes ¶
func (versions VersionsDB) LatestBuildPipes(ctx context.Context, buildID int) (map[int]BuildCursor, error)
func (VersionsDB) LatestBuildUsingLatestVersion ¶
func (VersionsDB) LatestVersionOfResource ¶
func (versions VersionsDB) LatestVersionOfResource(ctx context.Context, resourceID int) (ResourceVersion, bool, error)
func (VersionsDB) NextEveryVersion ¶
func (versions VersionsDB) NextEveryVersion(ctx context.Context, jobID int, resourceID int) (ResourceVersion, bool, bool, error)
func (VersionsDB) SuccessfulBuildOutputs ¶
func (versions VersionsDB) SuccessfulBuildOutputs(ctx context.Context, buildID int) ([]AlgorithmVersion, error)
func (VersionsDB) SuccessfulBuilds ¶
func (versions VersionsDB) SuccessfulBuilds(ctx context.Context, jobID int) PaginatedBuilds
func (VersionsDB) SuccessfulBuildsVersionConstrained ¶
func (versions VersionsDB) SuccessfulBuildsVersionConstrained( ctx context.Context, jobID int, constrainingCandidates map[string][]string, ) (PaginatedBuilds, error)
func (VersionsDB) UnusedBuilds ¶
func (versions VersionsDB) UnusedBuilds(ctx context.Context, jobID int, lastUsedBuild BuildCursor) (PaginatedBuilds, error)
func (VersionsDB) UnusedBuildsVersionConstrained ¶
func (versions VersionsDB) UnusedBuildsVersionConstrained(ctx context.Context, jobID int, lastUsedBuild BuildCursor, constrainingCandidates map[string][]string) (PaginatedBuilds, error)
func (VersionsDB) VersionExists ¶
func (versions VersionsDB) VersionExists(ctx context.Context, resourceID int, versionMD5 ResourceVersion) (bool, error)
func (VersionsDB) VersionIsDisabled ¶
func (versions VersionsDB) VersionIsDisabled(ctx context.Context, resourceID int, versionMD5 ResourceVersion) (bool, error)
type VolumeRepository ¶
type VolumeRepository interface {
GetTeamVolumes(teamID int) ([]CreatedVolume, error)
CreateContainerVolume(teamID int, workerName string, container CreatingContainer, mountPath string) (CreatingVolume, error)
FindContainerVolume(teamID int, workerName string, container CreatingContainer, mountPath string) (CreatingVolume, CreatedVolume, error)
FindBaseResourceTypeVolume(*UsedWorkerBaseResourceType) (CreatingVolume, CreatedVolume, error)
CreateBaseResourceTypeVolume(*UsedWorkerBaseResourceType) (CreatingVolume, error)
FindResourceCacheVolume(workerName string, resourceCache UsedResourceCache) (CreatedVolume, bool, error)
FindTaskCacheVolume(teamID int, workerName string, taskCache UsedTaskCache) (CreatedVolume, bool, error)
CreateTaskCacheVolume(teamID int, uwtc *UsedWorkerTaskCache) (CreatingVolume, error)
FindResourceCertsVolume(workerName string, uwrc *UsedWorkerResourceCerts) (CreatingVolume, CreatedVolume, error)
CreateResourceCertsVolume(workerName string, uwrc *UsedWorkerResourceCerts) (CreatingVolume, error)
FindVolumesForContainer(container CreatedContainer) ([]CreatedVolume, error)
GetOrphanedVolumes() ([]CreatedVolume, error)
DestroyFailedVolumes() (count int, err error)
GetDestroyingVolumes(workerName string) ([]string, error)
CreateVolume(int, string, VolumeType) (CreatingVolume, error)
FindCreatedVolume(handle string) (CreatedVolume, bool, error)
RemoveDestroyingVolumes(workerName string, handles []string) (int, error)
UpdateVolumesMissingSince(workerName string, handles []string) error
RemoveMissingVolumes(gracePeriod time.Duration) (removed int, err error)
DestroyUnknownVolumes(workerName string, handles []string) (int, error)
}
func NewVolumeRepository ¶
func NewVolumeRepository(conn Conn) VolumeRepository
type VolumeResourceType ¶
type VolumeResourceType struct {
WorkerBaseResourceType *UsedWorkerBaseResourceType
ResourceType *VolumeResourceType
Version atc.Version
}
type VolumeState ¶
type VolumeState string
const ( VolumeStateCreating VolumeState = "creating" VolumeStateCreated VolumeState = "created" VolumeStateDestroying VolumeState = "destroying" VolumeStateFailed VolumeState = "failed" )
type VolumeType ¶
type VolumeType string
const ( VolumeTypeContainer VolumeType = "container" VolumeTypeResource VolumeType = "resource" VolumeTypeResourceType VolumeType = "resource-type" VolumeTypeResourceCerts VolumeType = "resource-certs" VolumeTypeTaskCache VolumeType = "task-cache" VolumeTypeArtifact VolumeType = "artifact" VolumeTypeUknown VolumeType = "unknown" // for migration to life )
type Worker ¶
type Worker interface {
Name() string
Version() *string
State() WorkerState
GardenAddr() *string
BaggageclaimURL() *string
CertsPath() *string
ResourceCerts() (*UsedWorkerResourceCerts, bool, error)
HTTPProxyURL() string
HTTPSProxyURL() string
NoProxy() string
ActiveContainers() int
ActiveVolumes() int
ResourceTypes() []atc.WorkerResourceType
Platform() string
Tags() []string
TeamID() int
TeamName() string
StartTime() time.Time
ExpiresAt() time.Time
Ephemeral() bool
Reload() (bool, error)
Land() error
Retire() error
Prune() error
Delete() error
ActiveTasks() (int, error)
IncreaseActiveTasks() error
DecreaseActiveTasks() error
FindContainer(owner ContainerOwner) (CreatingContainer, CreatedContainer, error)
CreateContainer(owner ContainerOwner, meta ContainerMetadata) (CreatingContainer, error)
}
type WorkerArtifact ¶
type WorkerArtifact interface {
ID() int
Name() string
BuildID() int
CreatedAt() time.Time
Volume(teamID int) (CreatedVolume, bool, error)
}
TODO-L Can this be consolidated with atc/runtime/types.go -> Artifact OR Alternatively, there shouldn't be a volume reference here
type WorkerArtifactLifecycle ¶
type WorkerArtifactLifecycle interface {
RemoveExpiredArtifacts() error
}
type WorkerBaseResourceType ¶
func (WorkerBaseResourceType) Find ¶
func (workerBaseResourceType WorkerBaseResourceType) Find(runner sq.Runner) (*UsedWorkerBaseResourceType, bool, error)
type WorkerBaseResourceTypeFactory ¶
type WorkerBaseResourceTypeFactory interface {
Find(name string, worker Worker) (*UsedWorkerBaseResourceType, bool, error)
}
func NewWorkerBaseResourceTypeFactory ¶
func NewWorkerBaseResourceTypeFactory(conn Conn) WorkerBaseResourceTypeFactory
type WorkerFactory ¶
type WorkerFactory interface {
GetWorker(name string) (Worker, bool, error)
SaveWorker(atcWorker atc.Worker, ttl time.Duration) (Worker, error)
HeartbeatWorker(worker atc.Worker, ttl time.Duration) (Worker, error)
Workers() ([]Worker, error)
VisibleWorkers([]string) ([]Worker, error)
FindWorkersForContainerByOwner(ContainerOwner) ([]Worker, error)
BuildContainersCountPerWorker() (map[string]int, error)
}
func NewWorkerFactory ¶
func NewWorkerFactory(conn Conn) WorkerFactory
type WorkerLifecycle ¶
type WorkerLifecycle interface {
DeleteUnresponsiveEphemeralWorkers() ([]string, error)
StallUnresponsiveWorkers() ([]string, error)
LandFinishedLandingWorkers() ([]string, error)
DeleteFinishedRetiringWorkers() ([]string, error)
GetWorkerStateByName() (map[string]WorkerState, error)
}
func NewWorkerLifecycle ¶
func NewWorkerLifecycle(conn Conn) WorkerLifecycle
type WorkerResourceCache ¶
type WorkerResourceCache struct {
WorkerName string
ResourceCache UsedResourceCache
}
func (WorkerResourceCache) Find ¶
func (workerResourceCache WorkerResourceCache) Find(runner sq.Runner) (*UsedWorkerResourceCache, bool, error)
func (WorkerResourceCache) FindOrCreate ¶
func (workerResourceCache WorkerResourceCache) FindOrCreate(tx Tx) (*UsedWorkerResourceCache, error)
type WorkerResourceCerts ¶
func (WorkerResourceCerts) Find ¶
func (workerResourceCerts WorkerResourceCerts) Find(runner sq.BaseRunner) (*UsedWorkerResourceCerts, bool, error)
func (WorkerResourceCerts) FindOrCreate ¶
func (workerResourceCerts WorkerResourceCerts) FindOrCreate(tx Tx) (*UsedWorkerResourceCerts, error)
type WorkerResourceType ¶
type WorkerResourceType struct {
Worker Worker
Image string // The path to the image, e.g. '/opt/concourse/resources/git'.
Version string // The version of the image, e.g. a SHA of the rootfs.
BaseResourceType *BaseResourceType
}
func (WorkerResourceType) FindOrCreate ¶
func (wrt WorkerResourceType) FindOrCreate(tx Tx, unique bool) (*UsedWorkerResourceType, error)
type WorkerState ¶
type WorkerState string
func AllWorkerStates ¶
func AllWorkerStates() []WorkerState
type WorkerTaskCache ¶
type WorkerTaskCache struct {
WorkerName string
TaskCache UsedTaskCache
}
type WorkerTaskCacheFactory ¶
type WorkerTaskCacheFactory interface {
FindOrCreate(WorkerTaskCache) (*UsedWorkerTaskCache, error)
Find(WorkerTaskCache) (*UsedWorkerTaskCache, bool, error)
}
func NewWorkerTaskCacheFactory ¶
func NewWorkerTaskCacheFactory(conn Conn) WorkerTaskCacheFactory
Source Files
¶
- access_token.go
- access_token_factory.go
- access_token_lifecycle.go
- base_resource_type.go
- build.go
- build_event_source.go
- build_factory.go
- build_preparation.go
- check.go
- check_factory.go
- check_lifecycle.go
- checkable_counter.go
- clock.go
- component.go
- component_factory.go
- connection_retrying_driver.go
- connection_tracker.go
- container.go
- container_metadata.go
- container_owner.go
- container_repository.go
- input_mapping.go
- job.go
- job_factory.go
- keepalive_dialer.go
- log_conn.go
- notifications_bus.go
- notifier.go
- open.go
- pagination.go
- pipe.go
- pipeline.go
- pipeline_factory.go
- pipeline_lifecycle.go
- pipeline_ref.go
- psql.go
- resource.go
- resource_cache.go
- resource_cache_factory.go
- resource_cache_lifecycle.go
- resource_cache_user.go
- resource_config.go
- resource_config_check_session_lifecycle.go
- resource_config_factory.go
- resource_config_scope.go
- resource_config_version.go
- resource_factory.go
- resource_type.go
- scannable.go
- span_context.go
- task_cache.go
- task_cache_factory.go
- team.go
- team_factory.go
- user.go
- user_factory.go
- versions_db.go
- volume.go
- volume_repository.go
- wall.go
- worker.go
- worker_artifact.go
- worker_artifact_lifecycle.go
- worker_base_resource_type.go
- worker_base_resource_type_factory.go
- worker_factory.go
- worker_lifecycle.go
- worker_resource_cache.go
- worker_resource_certs.go
- worker_resource_type.go
- worker_task_cache.go
- worker_task_cache_factory.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
encryptionfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
lockfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
cli
command
|
|
|
migrationfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |