dbng

package
v0.0.0-...-e99be67 Latest Latest
Warning

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

Go to latest
Published: May 4, 2017 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 (
	ContainerStateCreating   = "creating"
	ContainerStateCreated    = "created"
	ContainerStateDestroying = "destroying"
)
View Source
const (
	VolumeStateCreating   = "creating"
	VolumeStateCreated    = "created"
	VolumeStateDestroying = "destroying"
)
View Source
const (
	VolumeTypeContainer    = "container"
	VolumeTypeResource     = "resource"
	VolumeTypeResourceType = "resource-type"
	VolumeTypeUknown       = "unknown" // for migration to life
)
View Source
const (
	WorkerStateRunning  = WorkerState("running")
	WorkerStateStalled  = WorkerState("stalled")
	WorkerStateLanding  = WorkerState("landing")
	WorkerStateLanded   = WorkerState("landed")
	WorkerStateRetiring = WorkerState("retiring")
)

Variables

View Source
var (
	ErrVolumeMarkDestroyingFailed                 = errors.New("could not mark volume as destroying")
	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")
)
View Source
var (
	ErrWorkerNotPresent         = errors.New("worker-not-present-in-db")
	ErrCannotPruneRunningWorker = errors.New("worker-not-stalled-for-pruning")
)
View Source
var EmptyParamsHash = mapHash(atc.Params{})
View Source
var ErrBaseResourceTypeAlreadyExists = errors.New("base-resource-type-already-exists")
View Source
var ErrBaseResourceTypeNotFound = errors.New("base resource type not found")
View Source
var ErrBuildDisappeared = errors.New("build-disappeared-from-db")
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 ErrContainerDisappeared = errors.New("container-disappeared-from-db")
View Source
var ErrEndOfBuildEventStream = errors.New("end of build event stream")
View Source
var ErrResourceCacheAlreadyExists = errors.New("resource-cache-already-exists")
View Source
var ErrResourceCacheDisappeared = errors.New("resource-cache-disappeared")
View Source
var ErrResourceConfigAlreadyExists = errors.New("resource config already exists")
View Source
var ErrResourceConfigDisappeared = errors.New("resource config disappeared")
View Source
var ErrResourceConfigParentDisappeared = errors.New("resource config parent disappeared")
View Source
var ErrSafeRetryCreateOrUpdate = errors.New("failed-to-run-safe-create-or-update-retrying")
View Source
var ErrSafeRetryFindOrCreate = errors.New("failed-to-run-safe-find-or-create-retrying")
View Source
var ErrTeamDisappeared = errors.New("team disappeared")
View Source
var ErrWorkerBaseResourceTypeAlreadyExists = errors.New("worker base resource type already exists")
View Source
var ErrWorkerBaseResourceTypeDisappeared = errors.New("worker base resource type disappeared")
View Source
var ErrWorkerResourceTypeNotFound = errors.New("worker resource type no longer exists (stale?)")

Functions

func NewNotificationsBus

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

Types

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 (BaseResourceType) FindOrCreate

func (brt BaseResourceType) FindOrCreate(tx Tx) (*UsedBaseResourceType, error)

FindOrCreate looks for an existing BaseResourceType and creates it if it doesn't exist. It returns a UsedBaseResourceType.

Note that if the BaseResourceType already existed, there's a chance that it will be garbage-collected before the referencing ResourceConfig can be created and used.

This method can return ErrBaseResourceTypeAlreadyExists if two concurrent FindOrCreates clashed. The caller should retry from the start of the transaction.

type BaseResourceTypeFactory

type BaseResourceTypeFactory interface {
	Find(name string) (*UsedBaseResourceType, bool, error)
}

func NewBaseResourceTypeFactory

func NewBaseResourceTypeFactory(conn Conn) BaseResourceTypeFactory

type Build

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

	IsRunning() bool

	Reload() (bool, error)

	Interceptible() (bool, error)
	AcquireTrackingLock(logger lager.Logger, interval time.Duration) (lock.Lock, bool, error)
	Preparation() (BuildPreparation, bool, error)

	Start(string, string) (bool, error)
	SaveStatus(s BuildStatus) error
	SetInterceptible(bool) error
	MarkAsFailed(cause error) error

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

	SaveInput(input BuildInput) error
	SaveOutput(vr VersionedResource, explicit bool) error
	UseInputs(inputs []BuildInput) error

	Resources() ([]BuildInput, []BuildOutput, error)
	GetVersionedResources() (SavedVersionedResources, error)
	SaveImageResourceVersion(planID atc.PlanID, resourceVersion atc.Version, resourceHash string) error

	Pipeline() (Pipeline, bool, error)

	Finish(s BuildStatus) error
	Delete() (bool, error)
	Abort() error
	AbortNotifier() (Notifier, error)
	Schedule() (bool, error)
}

type BuildFactory

type BuildFactory interface {
	Build(int) (Build, bool, error)
	PublicBuilds(Page) ([]Build, Pagination, error)
	GetAllStartedBuilds() ([]Build, error)

	// TODO: move to BuildLifecycle, new interface (see WorkerLifecycle)
	MarkNonInterceptibleBuilds() error
}

func NewBuildFactory

func NewBuildFactory(conn Conn, lockFactory lock.LockFactory) BuildFactory

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 BuildStatus

type BuildStatus string
const (
	BuildStatusPending   BuildStatus = "pending"
	BuildStatusStarted   BuildStatus = "started"
	BuildStatusAborted   BuildStatus = "aborted"
	BuildStatusSucceeded BuildStatus = "succeeded"
	BuildStatusFailed    BuildStatus = "failed"
	BuildStatusErrored   BuildStatus = "errored"
)

type ConfigVersion

type ConfigVersion int

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

type Conn

type Conn interface {
	Bus() NotificationsBus
	Close() error

	Begin() (Tx, 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{}) squirrel.RowScanner
	SetMaxIdleConns(n int)
	SetMaxOpenConns(n int)
	Stats() sql.DBStats
}

func Open

func Open(logger lager.Logger, sqlDriver string, sqlDataSource string) (Conn, error)

type Container

type Container interface {
	ID() int
	Handle() string
	WorkerName() string
	Metadata() ContainerMetadata
}

type ContainerFactory

type ContainerFactory interface {
	FindContainersForDeletion() ([]CreatingContainer, []CreatedContainer, []DestroyingContainer, error)
}

func NewContainerFactory

func NewContainerFactory(conn Conn) ContainerFactory

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 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 CreatedContainer interface {
	Container

	Discontinue() (DestroyingContainer, error)
	Destroying() (DestroyingContainer, error)
	IsHijacked() bool
	MarkAsHijacked() error
}

type CreatedVolume

type CreatedVolume interface {
	Handle() string
	Path() string
	Type() VolumeType
	CreateChildForContainer(CreatingContainer, string) (CreatingVolume, error)
	Destroying() (DestroyingVolume, error)
	Worker() Worker
	SizeInBytes() int64
	Initialize() error
	IsInitialized() (bool, error)
	ContainerHandle() string
	ParentHandle() string
	ResourceType() (*VolumeResourceType, error)
	BaseResourceType() (*UsedWorkerBaseResourceType, error)
}

type CreatingContainer

type CreatingContainer interface {
	Container

	Created() (CreatedContainer, error)
}

type CreatingVolume

type CreatingVolume interface {
	Handle() string
	ID() int
	Created() (CreatedVolume, error)
}

type DestroyingContainer

type DestroyingContainer interface {
	Container

	Destroy() (bool, error)
	IsDiscontinued() bool
}

type DestroyingVolume

type DestroyingVolume interface {
	Handle() string
	Destroy() (bool, error)
	Worker() Worker
}

type ErrCustomResourceTypeVersionNotFound

type ErrCustomResourceTypeVersionNotFound struct {
	Name string
}

func (ErrCustomResourceTypeVersionNotFound) Error

type ErrVolumeMarkCreatedFailed

type ErrVolumeMarkCreatedFailed struct {
	Handle string
}

func (ErrVolumeMarkCreatedFailed) Error

type EventSource

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

type Job

type Job interface {
	ID() int
	Name() string
	Paused() bool
	FirstLoggedBuildID() string
	PipelineID() int
	PipelineName() string
	TeamID() int
	TeamName() string
	Config() atc.JobConfig
}

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 NotificationsBus

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

type Notifier

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

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 Pipeline

type Pipeline interface {
	ID() int
	Name() string
	TeamID() int
	TeamName() string
	ConfigVersion() ConfigVersion
	Config() atc.Config
	Public() bool
	Paused() bool

	CheckPaused() (bool, error)
	Reload() (bool, error)

	SaveJob(job atc.JobConfig) error
	SetMaxInFlightReached(string, bool) error

	SetResourceCheckError(Resource, error) error

	GetAllPendingBuilds() (map[string][]Build, error)

	SaveResourceVersions(atc.ResourceConfig, []atc.Version) error
	GetResourceVersions(resourceName string, page Page) ([]SavedVersionedResource, Pagination, bool, error)
	GetLatestVersionedResource(resourceName string) (SavedVersionedResource, bool, error)
	GetVersionedResourceByVersion(atcVersion atc.Version, resourceName string) (SavedVersionedResource, bool, error)
	DisableVersionedResource(versionedResourceID int) error
	EnableVersionedResource(versionedResourceID int) error

	SaveIndependentInputMapping(inputMapping algorithm.InputMapping, jobName string) error
	SaveNextInputMapping(inputMapping algorithm.InputMapping, jobName string) error

	// TODO: move to job
	GetIndependentBuildInputs(jobName string) ([]BuildInput, error)
	GetNextBuildInputs(jobName string) ([]BuildInput, bool, error)
	DeleteNextInputMapping(jobName string) error
	EnsurePendingBuildExists(jobName string) error
	GetPendingBuildsForJob(jobName string) ([]Build, error)
	CreateJobBuild(jobName string) (Build, error)
	NextBuildInputs(jobName string) ([]BuildInput, bool, error)
	PauseJob(job string) error
	UnpauseJob(job string) error

	AcquireResourceCheckingLockWithIntervalCheck(
		logger lager.Logger,
		resource Resource,
		interval time.Duration,
		immediate bool,
	) (lock.Lock, bool, error)

	AcquireResourceTypeCheckingLockWithIntervalCheck(
		logger lager.Logger,
		resourceTypeName string,
		interval time.Duration,
		immediate bool,
	) (lock.Lock, bool, error)

	LoadVersionsDB() (*algorithm.VersionsDB, error)

	Resource(name string) (Resource, bool, error)
	Resources() ([]Resource, error)

	ResourceTypes() (ResourceTypes, error)
	ResourceType(name string) (ResourceType, bool, error)

	Job(name string) (Job, bool, error)

	Expose() error
	Hide() error

	Pause() error
	Unpause() error

	Destroy() error
	Rename(string) error
}

type PipelineFactory

type PipelineFactory interface {
	GetPipelineByID(teamID int, pipelineID int) Pipeline
	PublicPipelines() ([]Pipeline, error)
}

func NewPipelineFactory

func NewPipelineFactory(conn Conn, lockFactory lock.LockFactory) PipelineFactory

type PipelinePausedState

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

func (PipelinePausedState) Bool

func (state PipelinePausedState) Bool() *bool

type Resource

type Resource interface {
	ID() int
	Name() string
	PipelineName() string
	Type() string
	Source() atc.Source
	CheckEvery() string
	Tags() atc.Tags
	CheckError() error
	Paused() bool
}

type ResourceCache

type ResourceCache struct {
	ResourceConfig ResourceConfig // 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(
		logger lager.Logger,
		resourceUser ResourceUser,
		resourceTypeName string,
		version atc.Version,
		source atc.Source,
		params atc.Params,
		resourceTypes atc.VersionedResourceTypes,
	) (*UsedResourceCache, error)

	CleanUsesForFinishedBuilds() error
	CleanUsesForInactiveResourceTypes() error
	CleanUsesForInactiveResources() error
	CleanUsesForPausedPipelineResources() error

	CleanUpInvalidCaches() error
}

func NewResourceCacheFactory

func NewResourceCacheFactory(conn Conn, lockFactory lock.LockFactory) ResourceCacheFactory

type ResourceConfig

type ResourceConfig struct {
	// A resource type provided by a resource.
	CreatedByResourceCache *ResourceCache

	// 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(
		logger lager.Logger,
		user ResourceUser,
		resourceType string,
		source atc.Source,
		resourceTypes atc.VersionedResourceTypes,
	) (*UsedResourceConfig, error)

	CleanConfigUsesForFinishedBuilds() error
	CleanConfigUsesForInactiveResourceTypes() error
	CleanConfigUsesForInactiveResources() error
	CleanConfigUsesForPausedPipelinesResources() error
	CleanConfigUsesForOutdatedResourceConfigs() error
	CleanUselessConfigs() error

	AcquireResourceCheckingLock(
		logger lager.Logger,
		resourceUser ResourceUser,
		resourceType string,
		resourceSource atc.Source,
		resourceTypes atc.VersionedResourceTypes,
	) (lock.Lock, bool, error)
}

func NewResourceConfigFactory

func NewResourceConfigFactory(conn Conn, lockFactory lock.LockFactory) ResourceConfigFactory

type ResourceMetadataField

type ResourceMetadataField struct {
	Name  string
	Value string
}

type ResourceType

type ResourceType interface {
	ID() int
	Name() string
	Type() string
	Source() atc.Source

	Version() atc.Version
	SaveVersion(atc.Version) error

	Reload() (bool, error)
}

type ResourceTypeNotFoundError

type ResourceTypeNotFoundError struct {
	Name string
}

func (ResourceTypeNotFoundError) Error

type ResourceTypes

type ResourceTypes []ResourceType

func (ResourceTypes) Deserialize

func (resourceTypes ResourceTypes) Deserialize() atc.VersionedResourceTypes

type ResourceUser

type ResourceUser interface {
	UseResourceCache(lager.Logger, Tx, lock.LockFactory, ResourceCache) (*UsedResourceCache, error)
	UseResourceConfig(lager.Logger, Tx, lock.LockFactory, ResourceConfig) (*UsedResourceConfig, error)

	Description() string
}

func ForBuild

func ForBuild(id int) ResourceUser

func ForResource

func ForResource(id int) ResourceUser

func ForResourceType

func ForResourceType(id int) ResourceUser

type ResourceVersion

type ResourceVersion map[string]string

type SavedVersionedResource

type SavedVersionedResource struct {
	ID           int
	Enabled      bool
	ModifiedTime time.Time
	VersionedResource
	CheckOrder int
}

type SavedVersionedResources

type SavedVersionedResources []SavedVersionedResource

type Team

type Team interface {
	ID() int
	Name() string
	Admin() bool

	BasicAuth() *atc.BasicAuth
	Auth() map[string]*json.RawMessage

	Delete() error

	SavePipeline(
		pipelineName string,
		config atc.Config,
		from ConfigVersion,
		pausedState PipelinePausedState,
	) (Pipeline, bool, error)

	Pipeline(pipelineName string) (Pipeline, bool, error)
	Pipelines() ([]Pipeline, error)
	PublicPipelines() ([]Pipeline, error)
	VisiblePipelines() ([]Pipeline, error)
	OrderPipelines([]string) error

	CreateOneOffBuild() (Build, error)
	PrivateAndPublicBuilds(Page) ([]Build, Pagination, error)

	SaveWorker(atcWorker atc.Worker, ttl time.Duration) (Worker, error)
	Workers() ([]Worker, error)

	FindContainerByHandle(string) (Container, bool, error)
	FindContainersByMetadata(ContainerMetadata) ([]Container, error)

	FindCreatedContainerByHandle(string) (CreatedContainer, bool, error)

	FindWorkerForResourceCheckContainer(resourceConfig *UsedResourceConfig) (Worker, bool, error)
	FindResourceCheckContainerOnWorker(workerName string, resourceConfig *UsedResourceConfig) (CreatingContainer, CreatedContainer, error)
	CreateResourceCheckContainer(workerName string, resourceConfig *UsedResourceConfig, meta ContainerMetadata) (CreatingContainer, error)

	CreateResourceGetContainer(workerName string, resourceConfig *UsedResourceCache, meta ContainerMetadata) (CreatingContainer, error)

	FindWorkerForContainer(handle string) (Worker, bool, error)
	FindWorkerForBuildContainer(buildID int, planID atc.PlanID) (Worker, bool, error)
	FindBuildContainerOnWorker(workerName string, buildID int, planID atc.PlanID) (CreatingContainer, CreatedContainer, error)
	CreateBuildContainer(workerName string, buildID int, planID atc.PlanID, meta ContainerMetadata) (CreatingContainer, error)

	UpdateBasicAuth(basicAuth *atc.BasicAuth) error
	UpdateProviderAuth(auth map[string]*json.RawMessage) error
}

type TeamFactory

type TeamFactory interface {
	CreateTeam(atc.Team) (Team, error)
	FindTeam(string) (Team, bool, error)
	GetTeams() ([]Team, error)
	GetByID(teamID int) Team
}

func NewTeamFactory

func NewTeamFactory(conn Conn, lockFactory lock.LockFactory) TeamFactory

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{}) squirrel.RowScanner
	Rollback() error
	Stmt(stmt *sql.Stmt) *sql.Stmt
}

type UsedBaseResourceType

type UsedBaseResourceType struct {
	ID   int // The ID of the BaseResourceType.
	Name string
}

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 struct {
	ID             int
	ResourceConfig *UsedResourceConfig
	Version        atc.Version
}

UsedResourceCache is created whenever a ResourceCache is Created and/or Used.

So long as the UsedResourceCache exists, the underlying ResourceCache can not be removed.

UsedResourceCaches become unused by the gc.ResourceCacheCollector, which may then lead to the ResourceCache being garbage-collected.

See FindOrCreateForBuild, FindOrCreateForResource, and FindOrCreateForResourceType for more information on when it becomes unused.

func (*UsedResourceCache) BaseResourceType

func (usedResourceCache *UsedResourceCache) BaseResourceType() *UsedBaseResourceType

func (*UsedResourceCache) Destroy

func (cache *UsedResourceCache) Destroy(tx Tx) (bool, error)

type UsedResourceConfig

type UsedResourceConfig struct {
	ID                        int
	CreatedByResourceCache    *UsedResourceCache
	CreatedByBaseResourceType *UsedBaseResourceType
}

UsedResourceConfig is created whenever a ResourceConfig is Created and/or Used.

So long as the UsedResourceConfig exists, the underlying ResourceConfig can not be removed.

UsedResourceConfigs become unused by the gc.ResourceConfigCollector, which may then lead to the ResourceConfig being garbage-collected.

See FindOrCreateForBuild, FindOrCreateForResource, and FindOrCreateForResourceType for more information on when it becomes unused.

type UsedWorkerBaseResourceType

type UsedWorkerBaseResourceType struct {
	ID      int
	Name    string
	Version string

	Worker Worker
}

type UsedWorkerResourceCache

type UsedWorkerResourceCache struct {
	ID int
}

type UsedWorkerResourceType

type UsedWorkerResourceType struct {
	ID int

	Worker Worker

	UsedBaseResourceType *UsedBaseResourceType
}

type UserDisappearedError

type UserDisappearedError struct {
	User ResourceUser
}

func (UserDisappearedError) Error

func (err UserDisappearedError) Error() string

type VersionedResource

type VersionedResource struct {
	Resource string
	Type     string
	Version  ResourceVersion
	Metadata []ResourceMetadataField
}

type VolumeFactory

type VolumeFactory interface {
	GetTeamVolumes(teamID int) ([]CreatedVolume, error)

	CreateContainerVolume(int, Worker, CreatingContainer, string) (CreatingVolume, error)
	FindContainerVolume(int, Worker, CreatingContainer, string) (CreatingVolume, CreatedVolume, error)

	FindBaseResourceTypeVolume(int, *UsedWorkerBaseResourceType) (CreatingVolume, CreatedVolume, error)
	CreateBaseResourceTypeVolume(int, *UsedWorkerBaseResourceType) (CreatingVolume, error)

	FindResourceCacheVolume(Worker, *UsedResourceCache) (CreatingVolume, CreatedVolume, error)
	FindResourceCacheInitializedVolume(Worker, *UsedResourceCache) (CreatedVolume, bool, error)
	CreateResourceCacheVolume(Worker, *UsedResourceCache) (CreatingVolume, error)

	FindVolumesForContainer(CreatedContainer) ([]CreatedVolume, error)
	GetOrphanedVolumes() ([]CreatedVolume, []DestroyingVolume, error)
	GetDuplicateResourceCacheVolumes() ([]CreatingVolume, []CreatedVolume, []DestroyingVolume, error)

	FindCreatedVolume(handle string) (CreatedVolume, bool, error)
}

func NewVolumeFactory

func NewVolumeFactory(conn Conn) VolumeFactory

type VolumeResourceType

type VolumeResourceType struct {
	WorkerBaseResourceType *UsedWorkerBaseResourceType
	ResourceType           *VolumeResourceType
	Version                atc.Version
}

type VolumeState

type VolumeState string

type VolumeType

type VolumeType string

type Worker

type Worker interface {
	Name() string
	State() WorkerState
	GardenAddr() *string
	BaggageclaimURL() *string
	HTTPProxyURL() string
	HTTPSProxyURL() string
	NoProxy() string
	ActiveContainers() int
	ResourceTypes() []atc.WorkerResourceType
	Platform() string
	Tags() []string
	TeamID() int
	TeamName() string
	StartTime() int64
	ExpiresAt() time.Time

	Reload() (bool, error)

	Land() error
	Retire() error
	Prune() error
	Delete() error
}

type WorkerBaseResourceType

type WorkerBaseResourceType struct {
	Name       string
	WorkerName string
}

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)
}

func NewWorkerFactory

func NewWorkerFactory(conn Conn) WorkerFactory

type WorkerLifecycle

type WorkerLifecycle interface {
	StallUnresponsiveWorkers() ([]string, error)
	LandFinishedLandingWorkers() ([]string, error)
	DeleteFinishedRetiringWorkers() ([]string, 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 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) (*UsedWorkerResourceType, error)

type WorkerState

type WorkerState string

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