resource

package
v0.0.0-...-7fe2d08 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2016 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const GetResourceLeaseInterval = 5 * time.Second

Variables

View Source
var ErrAborted = errors.New("script aborted")
View Source
var ErrFailedToGetLease = errors.New("failed-to-get-lease")
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

Types

type ArtifactDestination

type ArtifactDestination interface {
	StreamIn(string, io.Reader) error
}

type ArtifactSource

type ArtifactSource interface {
	StreamTo(ArtifactDestination) error

	// VolumeOn returns a Volume object that contains the artifact from the
	// ArtifactSource which is on a particular Worker. If a volume cannot be found
	// or a volume manager cannot be found on the worker then it will return
	// false.
	VolumeOn(worker.Worker) (worker.Volume, bool, error)
}

type Cache

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

type CacheIdentifier

type CacheIdentifier interface {
	FindOn(lager.Logger, worker.Client) (worker.Volume, bool, error)
	CreateOn(lager.Logger, worker.Client) (worker.Volume, error)

	VolumeIdentifier() worker.VolumeIdentifier
}

type ContainerImage

type ContainerImage string

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 FetchContainerCreator

type FetchContainerCreator interface {
	CreateWithVolume(string, worker.Volume, worker.Worker) (worker.Container, error)
}

type FetchContainerCreatorFactory

type FetchContainerCreatorFactory interface {
	NewFetchContainerCreator(
		logger lager.Logger,
		resourceTypes atc.ResourceTypes,
		tags atc.Tags,
		teamID int,
		session Session,
		metadata Metadata,
		imageFetchingDelegate worker.ImageFetchingDelegate,
	) FetchContainerCreator
}

func NewFetchContainerCreatorFactory

func NewFetchContainerCreatorFactory() FetchContainerCreatorFactory

type FetchSource

type FetchSource interface {
	IsInitialized() (bool, error)
	LeaseName() (string, error)
	VersionedSource() VersionedSource
	Initialize(signals <-chan os.Signal, ready chan<- struct{}) error
	Release(*time.Duration)
}

func NewContainerFetchSource

func NewContainerFetchSource(
	logger lager.Logger,
	container worker.Container,
	resourceOptions ResourceOptions,
) FetchSource

func NewEmptyFetchSource

func NewEmptyFetchSource(
	logger lager.Logger,
	worker worker.Worker,
	cacheIdentifier CacheIdentifier,
	containerCreator FetchContainerCreator,
	resourceOptions ResourceOptions,
) FetchSource

func NewVolumeFetchSource

func NewVolumeFetchSource(
	logger lager.Logger,
	volume worker.Volume,
	worker worker.Worker,
	resourceOptions ResourceOptions,
	containerCreator FetchContainerCreator,
) FetchSource

type FetchSourceProvider

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

type FetchSourceProviderFactory

type FetchSourceProviderFactory interface {
	NewFetchSourceProvider(
		logger lager.Logger,
		session Session,
		tags atc.Tags,
		teamID int,
		resourceTypes atc.ResourceTypes,
		cacheIdentifier CacheIdentifier,
		resourceOptions ResourceOptions,
		containerCreator FetchContainerCreator,
	) FetchSourceProvider
}

func NewFetchSourceProviderFactory

func NewFetchSourceProviderFactory(workerClient worker.Client) FetchSourceProviderFactory

type Fetcher

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

func NewFetcher

func NewFetcher(
	clock clock.Clock,
	db LeaseDB,
	fetchContainerCreatorFactory FetchContainerCreatorFactory,
	fetchSourceProviderFactory FetchSourceProviderFactory,
) Fetcher

type FetcherFactory

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

func NewFetcherFactory

func NewFetcherFactory(
	db LeaseDB,
	clock clock.Clock,
) FetcherFactory

type IOConfig

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

type LeaseDB

type LeaseDB interface {
	GetLease(logger lager.Logger, leaseName string, interval time.Duration) (db.Lease, 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, ArtifactSource, <-chan os.Signal, chan<- struct{}) (VersionedSource, error)
	Check(atc.Source, atc.Version) ([]atc.Version, error)

	Release(*time.Duration)
}

func NewResource

func NewResource(container worker.Container) Resource

type ResourceCacheIdentifier

type ResourceCacheIdentifier struct {
	Type    ResourceType
	Version atc.Version
	Source  atc.Source
	Params  atc.Params
}

func (ResourceCacheIdentifier) CreateOn

func (identifier ResourceCacheIdentifier) CreateOn(logger lager.Logger, workerClient worker.Client) (worker.Volume, error)

func (ResourceCacheIdentifier) FindOn

func (identifier ResourceCacheIdentifier) FindOn(logger lager.Logger, workerClient worker.Client) (worker.Volume, bool, error)

func (ResourceCacheIdentifier) VolumeIdentifier

func (identifier ResourceCacheIdentifier) VolumeIdentifier() worker.VolumeIdentifier

type ResourceOptions

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

type ResourceType

type ResourceType string

type Session

type Session struct {
	ID        worker.Identifier
	Metadata  worker.Metadata
	Ephemeral bool
}

type TrackerFactory

type TrackerFactory interface {
	TrackerFor(client worker.Client) Tracker
}

func NewTrackerFactory

func NewTrackerFactory() TrackerFactory

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

type VolumeMount

type VolumeMount struct {
	Volume    worker.Volume
	MountPath 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

Jump to

Keyboard shortcuts

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