worker

package
v0.0.0-...-0e89551 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2015 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContainerNotFound = errors.New("container not found")
View Source
var ErrNoWorkers = errors.New("no workers")
View Source
var ErrUnsupportedResourceType = errors.New("unsupported resource type")

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateContainer(Identifier, ContainerSpec) (Container, error)
	LookupContainer(Identifier) (Container, error)
}

func NewPool

func NewPool(provider WorkerProvider) Client

type Container

type Container interface {
	garden.Container

	Destroy() error

	Release()
}

type ContainerSpec

type ContainerSpec interface {
	Description() string
}

type ContainerType

type ContainerType string
const (
	ContainerTypeCheck ContainerType = "check"
	ContainerTypeGet   ContainerType = "get"
	ContainerTypePut   ContainerType = "put"
	ContainerTypeTask  ContainerType = "task"
)

type ExponentialRetryPolicy

type ExponentialRetryPolicy struct {
	Timeout time.Duration
}

func (ExponentialRetryPolicy) DelayFor

func (policy ExponentialRetryPolicy) DelayFor(attempts uint) (time.Duration, bool)

type Identifier

type Identifier struct {
	Name string

	PipelineName string

	BuildID int

	Type ContainerType

	StepLocation uint

	CheckType   string
	CheckSource atc.Source
}

type MultipleContainersError

type MultipleContainersError struct {
	Handles []string
}

func (MultipleContainersError) Error

func (err MultipleContainersError) Error() string

type NoCompatibleWorkersError

type NoCompatibleWorkersError struct {
	Spec    ContainerSpec
	Workers []Worker
}

func (NoCompatibleWorkersError) Error

func (err NoCompatibleWorkersError) Error() string

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func (*Pool) CreateContainer

func (pool *Pool) CreateContainer(id Identifier, spec ContainerSpec) (Container, error)

func (*Pool) LookupContainer

func (pool *Pool) LookupContainer(id Identifier) (Container, error)

type ResourceTypeContainerSpec

type ResourceTypeContainerSpec struct {
	Type      string
	Ephemeral bool
	Tags      []string
}

func (ResourceTypeContainerSpec) Description

func (spec ResourceTypeContainerSpec) Description() string

type RetryPolicy

type RetryPolicy interface {
	DelayFor(uint) (time.Duration, bool)
}

type RetryableConnection

type RetryableConnection struct {
	gconn.Connection

	Logger      lager.Logger
	Sleeper     Sleeper
	RetryPolicy RetryPolicy
}

func (RetryableConnection) Attach

func (conn RetryableConnection) Attach(handle string, processID uint32, processIO garden.ProcessIO) (garden.Process, error)

func (RetryableConnection) Capacity

func (conn RetryableConnection) Capacity() (garden.Capacity, error)

func (RetryableConnection) Create

func (conn RetryableConnection) Create(spec garden.ContainerSpec) (string, error)

func (RetryableConnection) CurrentBandwidthLimits

func (conn RetryableConnection) CurrentBandwidthLimits(handle string) (garden.BandwidthLimits, error)

func (RetryableConnection) CurrentCPULimits

func (conn RetryableConnection) CurrentCPULimits(handle string) (garden.CPULimits, error)

func (RetryableConnection) CurrentDiskLimits

func (conn RetryableConnection) CurrentDiskLimits(handle string) (garden.DiskLimits, error)

func (RetryableConnection) CurrentMemoryLimits

func (conn RetryableConnection) CurrentMemoryLimits(handle string) (garden.MemoryLimits, error)

func (RetryableConnection) Destroy

func (conn RetryableConnection) Destroy(handle string) error

func (RetryableConnection) Info

func (conn RetryableConnection) Info(handle string) (garden.ContainerInfo, error)

func (RetryableConnection) LimitBandwidth

func (conn RetryableConnection) LimitBandwidth(handle string, limits garden.BandwidthLimits) (garden.BandwidthLimits, error)

func (RetryableConnection) LimitCPU

func (conn RetryableConnection) LimitCPU(handle string, limits garden.CPULimits) (garden.CPULimits, error)

func (RetryableConnection) LimitDisk

func (conn RetryableConnection) LimitDisk(handle string, limits garden.DiskLimits) (garden.DiskLimits, error)

func (RetryableConnection) LimitMemory

func (conn RetryableConnection) LimitMemory(handle string, limits garden.MemoryLimits) (garden.MemoryLimits, error)

func (RetryableConnection) List

func (conn RetryableConnection) List(properties garden.Properties) ([]string, error)

func (RetryableConnection) NetIn

func (conn RetryableConnection) NetIn(handle string, hostPort, containerPort uint32) (uint32, uint32, error)

func (RetryableConnection) NetOut

func (conn RetryableConnection) NetOut(handle string, rule garden.NetOutRule) error

func (RetryableConnection) Ping

func (conn RetryableConnection) Ping() error

func (RetryableConnection) Property

func (conn RetryableConnection) Property(handle string, name string) (string, error)

func (RetryableConnection) RemoveProperty

func (conn RetryableConnection) RemoveProperty(handle string, name string) error

func (RetryableConnection) Run

func (conn RetryableConnection) Run(handle string, processSpec garden.ProcessSpec, processIO garden.ProcessIO) (garden.Process, error)

func (RetryableConnection) SetProperty

func (conn RetryableConnection) SetProperty(handle string, name string, value string) error

func (RetryableConnection) Stop

func (conn RetryableConnection) Stop(handle string, kill bool) error

func (RetryableConnection) StreamIn

func (conn RetryableConnection) StreamIn(handle string, spec garden.StreamInSpec) error

func (RetryableConnection) StreamOut

func (conn RetryableConnection) StreamOut(handle string, spec garden.StreamOutSpec) (io.ReadCloser, error)

type Sleeper

type Sleeper interface {
	Sleep(time.Duration)
}

type TaskContainerSpec

type TaskContainerSpec struct {
	Platform string
	Tags     []string

	Image      string
	Privileged bool
}

func (TaskContainerSpec) Description

func (spec TaskContainerSpec) Description() string

type Worker

type Worker interface {
	Client

	ActiveContainers() int
	Satisfies(ContainerSpec) bool

	Description() string
}

func NewGardenWorker

func NewGardenWorker(
	gardenClient garden.Client,
	clock clock.Clock,
	activeContainers int,
	resourceTypes []atc.WorkerResourceType,
	platform string,
	tags []string,
) Worker

type WorkerDB

type WorkerDB interface {
	Workers() ([]db.WorkerInfo, error)
}

type WorkerProvider

type WorkerProvider interface {
	Workers() ([]Worker, error)
}

func NewDBWorkerProvider

func NewDBWorkerProvider(db WorkerDB, logger lager.Logger) WorkerProvider

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

Jump to

Keyboard shortcuts

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