resource

package
v4.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 18 Imported by: 259

Documentation

Index

Constants

View Source
const GetResourceLockInterval = 5 * time.Second
View Source
const TaskProcessID = "resource"

Variables

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

Functions

func ResourcesDir

func ResourcesDir(suffix string) string

TODO: check if we need it

Types

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)
	Find() (VersionedSource, bool, error)
	Create(context.Context) (VersionedSource, error)
}

func NewResourceInstanceFetchSource

func NewResourceInstanceFetchSource(
	logger lager.Logger,
	resourceInstance ResourceInstance,
	worker worker.Worker,
	resourceTypes creds.VersionedResourceTypes,
	tags atc.Tags,
	teamID int,
	session Session,
	metadata Metadata,
	imageFetchingDelegate worker.ImageFetchingDelegate,
	dbResourceCacheFactory db.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 creds.VersionedResourceTypes,
		resourceInstance ResourceInstance,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) FetchSourceProvider
}

func NewFetchSourceProviderFactory

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

type Fetcher

type Fetcher interface {
	Fetch(
		ctx context.Context,
		logger lager.Logger,
		session Session,
		tags atc.Tags,
		teamID int,
		resourceTypes creds.VersionedResourceTypes,
		resourceInstance ResourceInstance,
		metadata Metadata,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) (VersionedSource, error)
}

func NewFetcher

func NewFetcher(
	clock clock.Clock,
	lockFactory lock.LockFactory,
	fetchSourceProviderFactory FetchSourceProviderFactory,
) Fetcher

type FetcherFactory

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

func NewFetcherFactory

func NewFetcherFactory(
	lockFactory lock.LockFactory,
	clock clock.Clock,
	dbResourceCacheFactory db.ResourceCacheFactory,
) FetcherFactory

type IOConfig

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

type Metadata

type Metadata interface {
	Env() []string
}

type ResourceFactory

type ResourceFactory interface {
	NewResource(
		ctx context.Context,
		logger lager.Logger,
		owner db.ContainerOwner,
		metadata db.ContainerMetadata,
		containerSpec worker.ContainerSpec,
		resourceTypes creds.VersionedResourceTypes,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) (Resource, error)
}

func NewResourceFactory

func NewResourceFactory(workerClient worker.Client) ResourceFactory

type ResourceInstance

type ResourceInstance interface {
	// XXX: do we need these?
	Source() atc.Source
	Params() atc.Params
	Version() atc.Version
	ResourceType() ResourceType

	ResourceCache() db.UsedResourceCache
	ContainerOwner() db.ContainerOwner

	LockName(string) (string, error)

	FindOn(lager.Logger, worker.Worker) (worker.Volume, bool, error)
}

func NewResourceInstance

func NewResourceInstance(
	resourceTypeName ResourceType,
	version atc.Version,
	source atc.Source,
	params atc.Params,
	resourceTypes creds.VersionedResourceTypes,

	resourceCache db.UsedResourceCache,
	containerOwner db.ContainerOwner,
) ResourceInstance

type ResourceType

type ResourceType string

type Session

type Session struct {
	Metadata db.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
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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