resource

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

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

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

Documentation

Index

Constants

View Source
const GetResourceLockInterval = 5 * time.Second

Variables

View Source
var ErrAborted = errors.New("script aborted")
View Source
var ErrFailedToGetLock = errors.New("failed-to-get-lock")
View Source
var ErrInterrupted = errors.New("interrupted")

Functions

func GenerateResourceHash

func GenerateResourceHash(source atc.Source, resourceType string) string

func ResourcesDir

func ResourcesDir(suffix string) string

TODO: check if we need it

Types

type Cache

type Cache interface {
	IsInitialized() (bool, error)
	Initialize() error
	Volume() worker.Volume
}

type EmptyMetadata

type EmptyMetadata struct{}

func (EmptyMetadata) Env

func (m EmptyMetadata) Env() []string

type ErrResourceScriptFailed

type ErrResourceScriptFailed struct {
	Path       string
	Args       []string
	ExitStatus int

	Stderr string
}

func (ErrResourceScriptFailed) Error

func (err ErrResourceScriptFailed) Error() string

type FetchSource

type FetchSource interface {
	LockName() (string, error)
	FindInitialized() (VersionedSource, bool, error)
	Initialize(signals <-chan os.Signal, ready chan<- struct{}) (VersionedSource, error)
}

func NewResourceInstanceFetchSource

func NewResourceInstanceFetchSource(
	logger lager.Logger,
	resourceCache *dbng.UsedResourceCache,
	resourceInstance ResourceInstance,
	worker worker.Worker,
	resourceOptions ResourceOptions,
	resourceTypes atc.VersionedResourceTypes,
	tags atc.Tags,
	teamID int,
	session Session,
	metadata Metadata,
	imageFetchingDelegate worker.ImageFetchingDelegate,
	dbResourceCacheFactory dbng.ResourceCacheFactory,
) FetchSource

type FetchSourceProvider

type FetchSourceProvider interface {
	Get() (FetchSource, error)
}

type FetchSourceProviderFactory

type FetchSourceProviderFactory interface {
	NewFetchSourceProvider(
		logger lager.Logger,
		session Session,
		metadata Metadata,
		tags atc.Tags,
		teamID int,
		resourceTypes atc.VersionedResourceTypes,
		resourceInstance ResourceInstance,
		resourceOptions ResourceOptions,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) FetchSourceProvider
}

func NewFetchSourceProviderFactory

func NewFetchSourceProviderFactory(
	workerClient worker.Client,
	dbResourceCacheFactory dbng.ResourceCacheFactory,
) FetchSourceProviderFactory

type Fetcher

type Fetcher interface {
	Fetch(
		logger lager.Logger,
		session Session,
		tags atc.Tags,
		teamID int,
		resourceTypes atc.VersionedResourceTypes,
		resourceInstance ResourceInstance,
		metadata Metadata,
		imageFetchingDelegate worker.ImageFetchingDelegate,
		resourceOptions ResourceOptions,
		signals <-chan os.Signal,
		ready chan<- struct{},
	) (VersionedSource, error)
}

func NewFetcher

func NewFetcher(
	clock clock.Clock,
	db LockDB,
	fetchSourceProviderFactory FetchSourceProviderFactory,
) Fetcher

type FetcherFactory

type FetcherFactory interface {
	FetcherFor(workerClient worker.Client) Fetcher
}

func NewFetcherFactory

func NewFetcherFactory(
	db LockDB,
	clock clock.Clock,
	dbResourceCacheFactory dbng.ResourceCacheFactory,
) FetcherFactory

type IOConfig

type IOConfig struct {
	Stdout io.Writer
	Stderr io.Writer
}

type LockDB

type LockDB interface {
	GetTaskLock(logger lager.Logger, lockName string) (lock.Lock, bool, error)
}

type Metadata

type Metadata interface {
	Env() []string
}

type Resource

type Resource interface {
	Get(worker.Volume, IOConfig, atc.Source, atc.Params, atc.Version, <-chan os.Signal, chan<- struct{}) (VersionedSource, error)
	Put(IOConfig, atc.Source, atc.Params, <-chan os.Signal, chan<- struct{}) (VersionedSource, error)
	Check(atc.Source, atc.Version) ([]atc.Version, error)
	Container() worker.Container
}

func NewResourceForContainer

func NewResourceForContainer(container worker.Container) Resource

type ResourceFactory

type ResourceFactory interface {
	NewPutResource(
		logger lager.Logger,
		signals <-chan os.Signal,
		buildID int,
		planID atc.PlanID,
		metadata dbng.ContainerMetadata,
		containerSpec worker.ContainerSpec,
		resourceTypes atc.VersionedResourceTypes,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) (Resource, error)

	NewCheckResource(
		logger lager.Logger,
		signals <-chan os.Signal,
		resourceUser dbng.ResourceUser,
		resourceType string,
		resourceSource atc.Source,
		metadata dbng.ContainerMetadata,
		resourceSpec worker.ContainerSpec,
		resourceTypes atc.VersionedResourceTypes,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) (Resource, error)
}

type ResourceFactoryFactory

type ResourceFactoryFactory interface {
	FactoryFor(workerClient worker.Client) ResourceFactory
}

func NewResourceFactoryFactory

func NewResourceFactoryFactory() ResourceFactoryFactory

type ResourceInstance

type ResourceInstance interface {
	ResourceUser() dbng.ResourceUser

	FindInitializedOn(lager.Logger, worker.Client) (worker.Volume, bool, error)
	CreateOn(lager.Logger, worker.Client) (worker.Volume, error)

	ResourceCacheIdentifier() worker.ResourceCacheIdentifier
}

func NewResourceInstance

func NewResourceInstance(
	resourceTypeName ResourceType,
	version atc.Version,
	source atc.Source,
	params atc.Params,
	resourceUser dbng.ResourceUser,
	resourceTypes atc.VersionedResourceTypes,
	dbResourceCacheFactory dbng.ResourceCacheFactory,
) ResourceInstance

type ResourceOptions

type ResourceOptions interface {
	IOConfig() IOConfig
	Source() atc.Source
	Params() atc.Params
	Version() atc.Version
	ResourceType() ResourceType
	LockName(workerName string) (string, error)
}

type ResourceType

type ResourceType string

type Session

type Session struct {
	Metadata dbng.ContainerMetadata
}

type TrackerMetadata

type TrackerMetadata struct {
	ExternalURL  string
	PipelineName string
	ResourceName string
}

func (TrackerMetadata) Env

func (m TrackerMetadata) Env() []string

type VersionedSource

type VersionedSource interface {
	Version() atc.Version
	Metadata() []atc.MetadataField

	StreamOut(string) (io.ReadCloser, error)
	StreamIn(string, io.Reader) error

	Volume() worker.Volume
}

func NewGetVersionedSource

func NewGetVersionedSource(volume worker.Volume, version atc.Version, metadata []atc.MetadataField) VersionedSource

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

Jump to

Keyboard shortcuts

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