engine

package
v1.17.3-coveo.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 38 Imported by: 0

Documentation

Overview

Package engine contains code for interacting with container-running backends and handling events from them. It supports Docker as the sole task engine type.

Package engine contains the core logic for managing tasks

Package engine is a generated GoMock package.

Index

Constants

View Source
const (
	// ListContainersTimeout is the timeout for the ListContainers API.
	ListContainersTimeout = 10 * time.Minute
	// LoadImageTimeout is the timeout for the LoadImage API. It's set
	// to much lower value than pullImageTimeout as it involves loading
	// image from either a file or STDIN
	// calls involved.
	// TODO: Benchmark and re-evaluate this value
	LoadImageTimeout = 10 * time.Minute

	// StatsInactivityTimeout controls the amount of time we hold open a
	// connection to the Docker daemon waiting for stats data
	StatsInactivityTimeout = 5 * time.Second
)

Timelimits for docker operations enforced above docker

View Source
const (
	//DockerEndpointEnvVariable is the environment variable that can override the Docker endpoint
	DockerEndpointEnvVariable = "DOCKER_HOST"
	// DockerDefaultEndpoint is the default value for the Docker endpoint
	DockerDefaultEndpoint = "unix:///var/run/docker.sock"
)

Variables

View Source
var ImagePullDeleteLock sync.RWMutex

ImagePullDeleteLock ensures that pulls and deletes do not run at the same time and pulls can be run at the same time for docker >= 1.11.1 Pulls are serialized as a temporary workaround for a devicemapper issue. (see https://github.com/docker/docker/issues/9718) Deletes must not run at the same time as pulls to prevent deletion of images that are being used to launch new tasks.

Functions

This section is empty.

Types

type CannotCreateContainerError added in v1.14.0

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

CannotCreateContainerError indicates any error when trying to create a container

func (CannotCreateContainerError) Error added in v1.14.0

func (err CannotCreateContainerError) Error() string

func (CannotCreateContainerError) ErrorName added in v1.14.0

func (err CannotCreateContainerError) ErrorName() string

type CannotDescribeContainerError added in v1.14.0

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

CannotDescribeContainerError indicates any error when trying to describe a container

func (CannotDescribeContainerError) Error added in v1.14.0

func (CannotDescribeContainerError) ErrorName added in v1.14.0

func (err CannotDescribeContainerError) ErrorName() string

type CannotGetDockerClientError added in v1.5.0

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

CannotGetDockerClientError is a type for failing to get a specific Docker client

func (CannotGetDockerClientError) Error added in v1.5.0

func (CannotGetDockerClientError) ErrorName added in v1.5.0

func (CannotGetDockerClientError) ErrorName() string

ErrorName returns the name of the error

type CannotGetDockerClientVersionError

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

CannotGetDockerClientVersionError indicates error when trying to get docker client api version

func (CannotGetDockerClientVersionError) Error

func (CannotGetDockerClientVersionError) ErrorName

func (err CannotGetDockerClientVersionError) ErrorName() string

type CannotInspectContainerError added in v1.14.0

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

CannotInspectContainerError indicates any error when trying to inspect a container

func (CannotInspectContainerError) Error added in v1.14.0

func (err CannotInspectContainerError) Error() string

func (CannotInspectContainerError) ErrorName added in v1.14.0

func (err CannotInspectContainerError) ErrorName() string

type CannotListContainersError added in v1.14.0

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

CannotListContainersError indicates any error when trying to list containers

func (CannotListContainersError) Error added in v1.14.0

func (err CannotListContainersError) Error() string

func (CannotListContainersError) ErrorName added in v1.14.0

func (err CannotListContainersError) ErrorName() string

type CannotPullContainerError added in v1.14.0

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

CannotPullContainerError indicates any error when trying to pull a container image

func (CannotPullContainerError) Error added in v1.14.0

func (err CannotPullContainerError) Error() string

func (CannotPullContainerError) ErrorName added in v1.14.0

func (err CannotPullContainerError) ErrorName() string

type CannotPullECRContainerError added in v1.14.0

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

CannotPullECRContainerError indicates any error when trying to pull a container image from ECR

func (CannotPullECRContainerError) Error added in v1.14.0

func (err CannotPullECRContainerError) Error() string

func (CannotPullECRContainerError) ErrorName added in v1.14.0

func (err CannotPullECRContainerError) ErrorName() string

func (CannotPullECRContainerError) Retry

func (err CannotPullECRContainerError) Retry() bool

Retry fulfills the utils.Retrier interface and allows retries to be skipped by utils.Retry* functions

type CannotRemoveContainerError added in v1.14.0

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

CannotRemoveContainerError indicates any error when trying to remove a container

func (CannotRemoveContainerError) Error added in v1.14.0

func (err CannotRemoveContainerError) Error() string

func (CannotRemoveContainerError) ErrorName added in v1.14.0

func (err CannotRemoveContainerError) ErrorName() string

type CannotStartContainerError added in v1.14.0

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

CannotStartContainerError indicates any error when trying to start a container

func (CannotStartContainerError) Error added in v1.14.0

func (err CannotStartContainerError) Error() string

func (CannotStartContainerError) ErrorName added in v1.14.0

func (err CannotStartContainerError) ErrorName() string

type CannotStopContainerError added in v1.14.0

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

CannotStopContainerError indicates any error when trying to stop a container

func (CannotStopContainerError) Error added in v1.14.0

func (err CannotStopContainerError) Error() string

func (CannotStopContainerError) ErrorName added in v1.14.0

func (err CannotStopContainerError) ErrorName() string

func (CannotStopContainerError) IsRetriableError

func (err CannotStopContainerError) IsRetriableError() bool

IsRetriableError returns a boolean indicating whether the call that generated the error can be retried. When stopping a container, most errors that we can get should be considered retriable. However, in the case where the container is already stopped or doesn't exist at all, there's no sense in retrying.

type ContainerNetworkingError

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

ContainerNetworkingError indicates any error when dealing with the network namespace of container

func (ContainerNetworkingError) Error

func (err ContainerNetworkingError) Error() string

func (ContainerNetworkingError) ErrorName

func (err ContainerNetworkingError) ErrorName() string

type ContainerNotFound

type ContainerNotFound struct {
	// TaskArn is the ARN of the task the container belongs to
	TaskArn string
	// ContainerName is the name of the container that's missing
	ContainerName string
}

ContainerNotFound is a type for a missing container

func (ContainerNotFound) Error

func (cnferror ContainerNotFound) Error() string

Error returns an error string for the ContainerNotFound error

type ContainerVanishedError added in v1.1.0

type ContainerVanishedError struct{}

ContainerVanishedError is a type for describing a container that does not exist

func (ContainerVanishedError) Error added in v1.1.0

func (err ContainerVanishedError) Error() string

func (ContainerVanishedError) ErrorName added in v1.1.0

func (err ContainerVanishedError) ErrorName() string

ErrorName returns the name of the error

type CreateEmptyVolumeError

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

func (CreateEmptyVolumeError) Error

func (err CreateEmptyVolumeError) Error() string

func (CreateEmptyVolumeError) ErrorName

func (err CreateEmptyVolumeError) ErrorName() string

func (CreateEmptyVolumeError) Retry

func (err CreateEmptyVolumeError) Retry() bool

Retry fulfills the utils.Retrier interface and allows retries to be skipped by utils.Retry* functions

type DockerClient

type DockerClient interface {
	// SupportedVersions returns a slice of the supported docker versions (or at least supposedly supported).
	SupportedVersions() []dockerclient.DockerVersion

	// KnownVersions returns a slice of the Docker API versions known to the Docker daemon.
	KnownVersions() []dockerclient.DockerVersion

	// WithVersion returns a new DockerClient for which all operations will use the given remote api version.
	// A default version will be used for a client not produced via this method.
	WithVersion(dockerclient.DockerVersion) DockerClient

	// ContainerEvents returns a channel of DockerContainerChangeEvents. Events are placed into the channel and should
	// be processed by the listener.
	ContainerEvents(ctx context.Context) (<-chan DockerContainerChangeEvent, error)

	// PullImage pulls an image. authData should contain authentication data provided by the ECS backend.
	PullImage(image string, authData *api.RegistryAuthenticationData) DockerContainerMetadata

	// ImportLocalEmptyVolumeImage imports a locally-generated empty-volume image for supported platforms.
	ImportLocalEmptyVolumeImage() DockerContainerMetadata

	// CreateContainer creates a container with the provided docker.Config, docker.HostConfig, and name. A timeout value
	// should be provided for the request.
	CreateContainer(*docker.Config, *docker.HostConfig, string, time.Duration) DockerContainerMetadata

	// StartContainer starts the container identified by the name provided. A timeout value should be provided for the
	// request.
	StartContainer(string, time.Duration) DockerContainerMetadata

	// StopContainer stops the container identified by the name provided. A timeout value should be provided for the
	// request.
	StopContainer(string, time.Duration) DockerContainerMetadata

	// DescribeContainer returns status information about the specified container.
	DescribeContainer(string) (api.ContainerStatus, DockerContainerMetadata)

	// RemoveContainer removes a container (typically the rootfs, logs, and associated metadata) identified by the name.
	// A timeout value should be provided for the request.
	RemoveContainer(string, time.Duration) error

	// InspectContainer returns information about the specified container. A timeout value should be provided for the
	// request.
	InspectContainer(string, time.Duration) (*docker.Container, error)

	// ListContainers returns the set of containers known to the Docker daemon. A timeout value should be provided for
	// the request.
	ListContainers(bool, time.Duration) ListContainersResponse

	// Stats returns a channel of stat data for the specified container. A context should be provided so the request can
	// be canceled.
	Stats(string, context.Context) (<-chan *docker.Stats, error)

	// Version returns the version of the Docker daemon.
	Version() (string, error)
	// APIVersion returns the api version of the client
	APIVersion() (dockerclient.DockerVersion, error)

	// InspectImage returns information about the specified image.
	InspectImage(string) (*docker.Image, error)

	// RemoveImage removes the metadata associated with an image and may remove the underlying layer data. A timeout
	// value should be provided for the request.
	RemoveImage(string, time.Duration) error
	LoadImage(io.Reader, time.Duration) error
}

DockerClient interface to make testing it easier

func NewDockerGoClient

func NewDockerGoClient(clientFactory dockerclient.Factory, cfg *config.Config) (DockerClient, error)

NewDockerGoClient creates a new DockerGoClient

type DockerContainerChangeEvent

type DockerContainerChangeEvent struct {
	// Status represents the container's status in the event
	Status api.ContainerStatus
	// DockerContainerMetadata is the metadata of the container in the event
	DockerContainerMetadata
	// Type is the event type received from docker events
	Type api.DockerEventType
}

DockerContainerChangeEvent is a type for container change events

func (*DockerContainerChangeEvent) String

func (event *DockerContainerChangeEvent) String() string

String returns a human readable string of the container change event

type DockerContainerMetadata added in v1.1.0

type DockerContainerMetadata struct {
	// DockerID is the contianer's id generated by Docker
	DockerID string
	// ExitCode contains container's exit code if it has stopped
	ExitCode *int
	// PortBindings is the list of port binding information of the container
	PortBindings []api.PortBinding
	// Error wraps various container transition errors and is set if engine
	// is unable to perform any of the required container transitions
	Error engineError
	// Volumes contains volume informaton for the container
	Volumes map[string]string
	// Labels contains labels set for the container
	Labels map[string]string
	// CreatedAt is the timestamp of container creation
	CreatedAt time.Time
	// StartedAt is the timestamp of container start
	StartedAt time.Time
	// FinishedAt is the timestamp of container stop
	FinishedAt time.Time
	// Health contains the result of a container health check
	Health api.HealthStatus
}

DockerContainerMetadata is a type for metadata about Docker containers

type DockerStateError added in v1.1.0

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

DockerStateError is a wrapper around the error docker puts in the '.State.Error' field of its inspect output.

func NewDockerStateError added in v1.1.0

func NewDockerStateError(err string) DockerStateError

NewDockerStateError creates a DockerStateError

func (DockerStateError) Error added in v1.1.0

func (err DockerStateError) Error() string

func (DockerStateError) ErrorName added in v1.1.0

func (err DockerStateError) ErrorName() string

ErrorName returns the name of the error

type DockerTaskEngine

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

DockerTaskEngine is a state machine for managing a task and its containers in ECS.

DockerTaskEngine implements an abstraction over the DockerGoClient so that it does not have to know about tasks, only containers The DockerTaskEngine interacts with Docker to implement a TaskEngine

func NewDockerTaskEngine

func NewDockerTaskEngine(cfg *config.Config, client DockerClient,
	credentialsManager credentials.Manager, containerChangeEventStream *eventstream.EventStream,
	imageManager ImageManager, state dockerstate.TaskEngineState,
	metadataManager containermetadata.Manager,
	resource resources.Resource) *DockerTaskEngine

NewDockerTaskEngine returns a created, but uninitialized, DockerTaskEngine. The distinction between created and initialized is that when created it may be serialized/deserialized, but it will not communicate with docker until it is also initialized.

func (*DockerTaskEngine) AddTask

func (engine *DockerTaskEngine) AddTask(task *api.Task) error

AddTask starts tracking a task

func (*DockerTaskEngine) CheckTaskState added in v1.1.0

func (engine *DockerTaskEngine) CheckTaskState(task *api.Task)

CheckTaskState inspects the state of all containers within a task and writes their state to the managed task's container channel.

func (*DockerTaskEngine) Disable added in v1.0.0

func (engine *DockerTaskEngine) Disable()

Disable prevents this engine from managing any additional tasks.

func (*DockerTaskEngine) GetTaskByArn added in v1.8.2

func (engine *DockerTaskEngine) GetTaskByArn(arn string) (*api.Task, bool)

GetTaskByArn returns the task identified by that ARN

func (*DockerTaskEngine) Init

func (engine *DockerTaskEngine) Init(ctx context.Context) error

Init initializes a DockerTaskEngine such that it may communicate with docker and operate normally. This function must be called before any other function, except serializing and deserializing, can succeed without error.

func (*DockerTaskEngine) ListTasks

func (engine *DockerTaskEngine) ListTasks() ([]*api.Task, error)

ListTasks returns the tasks currently managed by the DockerTaskEngine

func (*DockerTaskEngine) MarshalJSON

func (engine *DockerTaskEngine) MarshalJSON() ([]byte, error)

MarshalJSON marshals into state directly

func (*DockerTaskEngine) MustInit

func (engine *DockerTaskEngine) MustInit(ctx context.Context)

MustInit blocks and retries until an engine can be initialized.

func (*DockerTaskEngine) SetDockerClient added in v1.1.0

func (engine *DockerTaskEngine) SetDockerClient(client DockerClient)

SetDockerClient provides a way to override the client used for communication with docker as a testing hook.

func (*DockerTaskEngine) SetSaver

func (engine *DockerTaskEngine) SetSaver(saver statemanager.Saver)

SetSaver sets the saver that is used by the DockerTaskEngine

func (*DockerTaskEngine) Shutdown added in v1.1.0

func (engine *DockerTaskEngine) Shutdown()

Shutdown makes a best-effort attempt to cleanup after the task engine. This should not be relied on for anything more complicated than testing.

func (*DockerTaskEngine) State

State is a function primarily meant for testing usage; it is explicitly not part of the TaskEngine interface and should not be relied upon. It returns an internal representation of the state of this DockerTaskEngine.

func (*DockerTaskEngine) StateChangeEvents

func (engine *DockerTaskEngine) StateChangeEvents() chan statechange.Event

StateChangeEvents returns channels to read task and container state changes. These changes should be read as soon as possible as them not being read will block processing the task referenced by the event.

func (*DockerTaskEngine) UnmarshalJSON

func (engine *DockerTaskEngine) UnmarshalJSON(data []byte) error

UnmarshalJSON restores a previously marshaled task-engine state from json

func (*DockerTaskEngine) Version added in v1.0.0

func (engine *DockerTaskEngine) Version() (string, error)

Version returns the underlying docker version.

type DockerTimeoutError added in v1.1.0

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

DockerTimeoutError is an error type for describing timeouts

func (*DockerTimeoutError) Error added in v1.1.0

func (err *DockerTimeoutError) Error() string

func (*DockerTimeoutError) ErrorName added in v1.1.0

func (err *DockerTimeoutError) ErrorName() string

ErrorName returns the name of the error

type ImageManager added in v1.13.0

type ImageManager interface {
	RecordContainerReference(container *api.Container) error
	RemoveContainerReferenceFromImageState(container *api.Container) error
	AddAllImageStates(imageStates []*image.ImageState)
	GetImageStateFromImageName(containerImageName string) *image.ImageState
	StartImageCleanupProcess(ctx context.Context)
	SetSaver(stateManager statemanager.Saver)
}

ImageManager is responsible for saving the Image states, adding and removing container references to ImageStates

func NewImageManager added in v1.13.0

func NewImageManager(cfg *config.Config, client DockerClient, state dockerstate.TaskEngineState) ImageManager

NewImageManager returns a new ImageManager

type ImageStatesForDeletion added in v1.13.0

type ImageStatesForDeletion []*image.ImageState

ImageStatesForDeletion is used for implementing the sort interface

func (ImageStatesForDeletion) Len added in v1.13.0

func (imageStates ImageStatesForDeletion) Len() int

Implementing sort interface based on last used times of the images

func (ImageStatesForDeletion) Less added in v1.13.0

func (imageStates ImageStatesForDeletion) Less(i, j int) bool

func (ImageStatesForDeletion) Swap added in v1.13.0

func (imageStates ImageStatesForDeletion) Swap(i, j int)

type InfiniteBuffer

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

InfiniteBuffer defines an unlimited buffer, where it reads from input channel and write to output channel.

func NewInfiniteBuffer

func NewInfiniteBuffer() *InfiniteBuffer

NewInfiniteBuffer returns an InfiniteBuffer object

func (*InfiniteBuffer) Consume

func (buffer *InfiniteBuffer) Consume(in chan<- *docker.APIEvents)

Consume reads the buffer and write to a listener channel

func (*InfiniteBuffer) CopyEvents

func (buffer *InfiniteBuffer) CopyEvents(event *docker.APIEvents)

CopyEvents copies the event into the buffer

func (*InfiniteBuffer) StartListening

func (buffer *InfiniteBuffer) StartListening(events chan *docker.APIEvents)

StartListening starts reading from the input channel and writes to the buffer TODO: wire in ctx to stop listening

type ListContainersResponse added in v1.2.0

type ListContainersResponse struct {
	// DockerIDs is the list of container IDs from the ListContainers call
	DockerIDs []string
	// Error contains any error returned when listing containers
	Error error
}

ListContainersResponse encapsulates the response from the docker client for the ListContainers call.

type MockDockerClient added in v1.7.0

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

MockDockerClient is a mock of DockerClient interface

func NewMockDockerClient added in v1.7.0

func NewMockDockerClient(ctrl *gomock.Controller) *MockDockerClient

NewMockDockerClient creates a new mock instance

func (*MockDockerClient) APIVersion

func (m *MockDockerClient) APIVersion() (dockerclient.DockerVersion, error)

APIVersion mocks base method

func (*MockDockerClient) ContainerEvents added in v1.7.0

func (m *MockDockerClient) ContainerEvents(arg0 context.Context) (<-chan DockerContainerChangeEvent, error)

ContainerEvents mocks base method

func (*MockDockerClient) CreateContainer added in v1.7.0

CreateContainer mocks base method

func (*MockDockerClient) DescribeContainer added in v1.7.0

func (m *MockDockerClient) DescribeContainer(arg0 string) (api.ContainerStatus, DockerContainerMetadata)

DescribeContainer mocks base method

func (*MockDockerClient) EXPECT added in v1.7.0

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDockerClient) ImportLocalEmptyVolumeImage

func (m *MockDockerClient) ImportLocalEmptyVolumeImage() DockerContainerMetadata

ImportLocalEmptyVolumeImage mocks base method

func (*MockDockerClient) InspectContainer added in v1.7.0

func (m *MockDockerClient) InspectContainer(arg0 string, arg1 time.Duration) (*go_dockerclient.Container, error)

InspectContainer mocks base method

func (*MockDockerClient) InspectImage added in v1.13.0

func (m *MockDockerClient) InspectImage(arg0 string) (*go_dockerclient.Image, error)

InspectImage mocks base method

func (*MockDockerClient) KnownVersions

func (m *MockDockerClient) KnownVersions() []dockerclient.DockerVersion

KnownVersions mocks base method

func (*MockDockerClient) ListContainers added in v1.7.0

func (m *MockDockerClient) ListContainers(arg0 bool, arg1 time.Duration) ListContainersResponse

ListContainers mocks base method

func (*MockDockerClient) LoadImage

func (m *MockDockerClient) LoadImage(arg0 io.Reader, arg1 time.Duration) error

LoadImage mocks base method

func (*MockDockerClient) PullImage added in v1.7.0

PullImage mocks base method

func (*MockDockerClient) RemoveContainer added in v1.7.0

func (m *MockDockerClient) RemoveContainer(arg0 string, arg1 time.Duration) error

RemoveContainer mocks base method

func (*MockDockerClient) RemoveImage added in v1.13.0

func (m *MockDockerClient) RemoveImage(arg0 string, arg1 time.Duration) error

RemoveImage mocks base method

func (*MockDockerClient) StartContainer added in v1.7.0

func (m *MockDockerClient) StartContainer(arg0 string, arg1 time.Duration) DockerContainerMetadata

StartContainer mocks base method

func (*MockDockerClient) Stats added in v1.10.0

func (m *MockDockerClient) Stats(arg0 string, arg1 context.Context) (<-chan *go_dockerclient.Stats, error)

Stats mocks base method

func (*MockDockerClient) StopContainer added in v1.7.0

func (m *MockDockerClient) StopContainer(arg0 string, arg1 time.Duration) DockerContainerMetadata

StopContainer mocks base method

func (*MockDockerClient) SupportedVersions added in v1.7.0

func (m *MockDockerClient) SupportedVersions() []dockerclient.DockerVersion

SupportedVersions mocks base method

func (*MockDockerClient) Version added in v1.7.0

func (m *MockDockerClient) Version() (string, error)

Version mocks base method

func (*MockDockerClient) WithVersion added in v1.7.0

WithVersion mocks base method

type MockDockerClientMockRecorder

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

MockDockerClientMockRecorder is the mock recorder for MockDockerClient

func (*MockDockerClientMockRecorder) APIVersion

func (mr *MockDockerClientMockRecorder) APIVersion() *gomock.Call

APIVersion indicates an expected call of APIVersion

func (*MockDockerClientMockRecorder) ContainerEvents

func (mr *MockDockerClientMockRecorder) ContainerEvents(arg0 interface{}) *gomock.Call

ContainerEvents indicates an expected call of ContainerEvents

func (*MockDockerClientMockRecorder) CreateContainer

func (mr *MockDockerClientMockRecorder) CreateContainer(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

CreateContainer indicates an expected call of CreateContainer

func (*MockDockerClientMockRecorder) DescribeContainer

func (mr *MockDockerClientMockRecorder) DescribeContainer(arg0 interface{}) *gomock.Call

DescribeContainer indicates an expected call of DescribeContainer

func (*MockDockerClientMockRecorder) ImportLocalEmptyVolumeImage

func (mr *MockDockerClientMockRecorder) ImportLocalEmptyVolumeImage() *gomock.Call

ImportLocalEmptyVolumeImage indicates an expected call of ImportLocalEmptyVolumeImage

func (*MockDockerClientMockRecorder) InspectContainer

func (mr *MockDockerClientMockRecorder) InspectContainer(arg0, arg1 interface{}) *gomock.Call

InspectContainer indicates an expected call of InspectContainer

func (*MockDockerClientMockRecorder) InspectImage

func (mr *MockDockerClientMockRecorder) InspectImage(arg0 interface{}) *gomock.Call

InspectImage indicates an expected call of InspectImage

func (*MockDockerClientMockRecorder) KnownVersions

func (mr *MockDockerClientMockRecorder) KnownVersions() *gomock.Call

KnownVersions indicates an expected call of KnownVersions

func (*MockDockerClientMockRecorder) ListContainers

func (mr *MockDockerClientMockRecorder) ListContainers(arg0, arg1 interface{}) *gomock.Call

ListContainers indicates an expected call of ListContainers

func (*MockDockerClientMockRecorder) LoadImage

func (mr *MockDockerClientMockRecorder) LoadImage(arg0, arg1 interface{}) *gomock.Call

LoadImage indicates an expected call of LoadImage

func (*MockDockerClientMockRecorder) PullImage

func (mr *MockDockerClientMockRecorder) PullImage(arg0, arg1 interface{}) *gomock.Call

PullImage indicates an expected call of PullImage

func (*MockDockerClientMockRecorder) RemoveContainer

func (mr *MockDockerClientMockRecorder) RemoveContainer(arg0, arg1 interface{}) *gomock.Call

RemoveContainer indicates an expected call of RemoveContainer

func (*MockDockerClientMockRecorder) RemoveImage

func (mr *MockDockerClientMockRecorder) RemoveImage(arg0, arg1 interface{}) *gomock.Call

RemoveImage indicates an expected call of RemoveImage

func (*MockDockerClientMockRecorder) StartContainer

func (mr *MockDockerClientMockRecorder) StartContainer(arg0, arg1 interface{}) *gomock.Call

StartContainer indicates an expected call of StartContainer

func (*MockDockerClientMockRecorder) Stats

func (mr *MockDockerClientMockRecorder) Stats(arg0, arg1 interface{}) *gomock.Call

Stats indicates an expected call of Stats

func (*MockDockerClientMockRecorder) StopContainer

func (mr *MockDockerClientMockRecorder) StopContainer(arg0, arg1 interface{}) *gomock.Call

StopContainer indicates an expected call of StopContainer

func (*MockDockerClientMockRecorder) SupportedVersions

func (mr *MockDockerClientMockRecorder) SupportedVersions() *gomock.Call

SupportedVersions indicates an expected call of SupportedVersions

func (*MockDockerClientMockRecorder) Version

func (mr *MockDockerClientMockRecorder) Version() *gomock.Call

Version indicates an expected call of Version

func (*MockDockerClientMockRecorder) WithVersion

func (mr *MockDockerClientMockRecorder) WithVersion(arg0 interface{}) *gomock.Call

WithVersion indicates an expected call of WithVersion

type MockImageManager added in v1.13.0

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

MockImageManager is a mock of ImageManager interface

func NewMockImageManager added in v1.13.0

func NewMockImageManager(ctrl *gomock.Controller) *MockImageManager

NewMockImageManager creates a new mock instance

func (*MockImageManager) AddAllImageStates added in v1.13.0

func (m *MockImageManager) AddAllImageStates(arg0 []*image.ImageState)

AddAllImageStates mocks base method

func (*MockImageManager) EXPECT added in v1.13.0

EXPECT returns an object that allows the caller to indicate expected use

func (*MockImageManager) GetImageStateFromImageName added in v1.13.0

func (m *MockImageManager) GetImageStateFromImageName(arg0 string) *image.ImageState

GetImageStateFromImageName mocks base method

func (*MockImageManager) RecordContainerReference added in v1.13.1

func (m *MockImageManager) RecordContainerReference(arg0 *api.Container) error

RecordContainerReference mocks base method

func (*MockImageManager) RemoveContainerReferenceFromImageState added in v1.13.0

func (m *MockImageManager) RemoveContainerReferenceFromImageState(arg0 *api.Container) error

RemoveContainerReferenceFromImageState mocks base method

func (*MockImageManager) SetSaver added in v1.13.0

func (m *MockImageManager) SetSaver(arg0 statemanager.Saver)

SetSaver mocks base method

func (*MockImageManager) StartImageCleanupProcess added in v1.13.0

func (m *MockImageManager) StartImageCleanupProcess(arg0 context.Context)

StartImageCleanupProcess mocks base method

type MockImageManagerMockRecorder

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

MockImageManagerMockRecorder is the mock recorder for MockImageManager

func (*MockImageManagerMockRecorder) AddAllImageStates

func (mr *MockImageManagerMockRecorder) AddAllImageStates(arg0 interface{}) *gomock.Call

AddAllImageStates indicates an expected call of AddAllImageStates

func (*MockImageManagerMockRecorder) GetImageStateFromImageName

func (mr *MockImageManagerMockRecorder) GetImageStateFromImageName(arg0 interface{}) *gomock.Call

GetImageStateFromImageName indicates an expected call of GetImageStateFromImageName

func (*MockImageManagerMockRecorder) RecordContainerReference

func (mr *MockImageManagerMockRecorder) RecordContainerReference(arg0 interface{}) *gomock.Call

RecordContainerReference indicates an expected call of RecordContainerReference

func (*MockImageManagerMockRecorder) RemoveContainerReferenceFromImageState

func (mr *MockImageManagerMockRecorder) RemoveContainerReferenceFromImageState(arg0 interface{}) *gomock.Call

RemoveContainerReferenceFromImageState indicates an expected call of RemoveContainerReferenceFromImageState

func (*MockImageManagerMockRecorder) SetSaver

func (mr *MockImageManagerMockRecorder) SetSaver(arg0 interface{}) *gomock.Call

SetSaver indicates an expected call of SetSaver

func (*MockImageManagerMockRecorder) StartImageCleanupProcess

func (mr *MockImageManagerMockRecorder) StartImageCleanupProcess(arg0 interface{}) *gomock.Call

StartImageCleanupProcess indicates an expected call of StartImageCleanupProcess

type MockTaskEngine added in v1.7.0

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

MockTaskEngine is a mock of TaskEngine interface

func NewMockTaskEngine added in v1.7.0

func NewMockTaskEngine(ctrl *gomock.Controller) *MockTaskEngine

NewMockTaskEngine creates a new mock instance

func (*MockTaskEngine) AddTask added in v1.7.0

func (m *MockTaskEngine) AddTask(arg0 *api.Task) error

AddTask mocks base method

func (*MockTaskEngine) Disable added in v1.7.0

func (m *MockTaskEngine) Disable()

Disable mocks base method

func (*MockTaskEngine) EXPECT added in v1.7.0

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTaskEngine) GetTaskByArn added in v1.8.2

func (m *MockTaskEngine) GetTaskByArn(arg0 string) (*api.Task, bool)

GetTaskByArn mocks base method

func (*MockTaskEngine) Init added in v1.7.0

func (m *MockTaskEngine) Init(arg0 context.Context) error

Init mocks base method

func (*MockTaskEngine) ListTasks added in v1.7.0

func (m *MockTaskEngine) ListTasks() ([]*api.Task, error)

ListTasks mocks base method

func (*MockTaskEngine) MarshalJSON added in v1.7.0

func (m *MockTaskEngine) MarshalJSON() ([]byte, error)

MarshalJSON mocks base method

func (*MockTaskEngine) MustInit added in v1.7.0

func (m *MockTaskEngine) MustInit(arg0 context.Context)

MustInit mocks base method

func (*MockTaskEngine) SetSaver added in v1.7.0

func (m *MockTaskEngine) SetSaver(arg0 statemanager.Saver)

SetSaver mocks base method

func (*MockTaskEngine) StateChangeEvents

func (m *MockTaskEngine) StateChangeEvents() chan statechange.Event

StateChangeEvents mocks base method

func (*MockTaskEngine) UnmarshalJSON added in v1.7.0

func (m *MockTaskEngine) UnmarshalJSON(arg0 []byte) error

UnmarshalJSON mocks base method

func (*MockTaskEngine) Version added in v1.7.0

func (m *MockTaskEngine) Version() (string, error)

Version mocks base method

type MockTaskEngineMockRecorder

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

MockTaskEngineMockRecorder is the mock recorder for MockTaskEngine

func (*MockTaskEngineMockRecorder) AddTask

func (mr *MockTaskEngineMockRecorder) AddTask(arg0 interface{}) *gomock.Call

AddTask indicates an expected call of AddTask

func (*MockTaskEngineMockRecorder) Disable

func (mr *MockTaskEngineMockRecorder) Disable() *gomock.Call

Disable indicates an expected call of Disable

func (*MockTaskEngineMockRecorder) GetTaskByArn

func (mr *MockTaskEngineMockRecorder) GetTaskByArn(arg0 interface{}) *gomock.Call

GetTaskByArn indicates an expected call of GetTaskByArn

func (*MockTaskEngineMockRecorder) Init

func (mr *MockTaskEngineMockRecorder) Init(arg0 interface{}) *gomock.Call

Init indicates an expected call of Init

func (*MockTaskEngineMockRecorder) ListTasks

func (mr *MockTaskEngineMockRecorder) ListTasks() *gomock.Call

ListTasks indicates an expected call of ListTasks

func (*MockTaskEngineMockRecorder) MarshalJSON

func (mr *MockTaskEngineMockRecorder) MarshalJSON() *gomock.Call

MarshalJSON indicates an expected call of MarshalJSON

func (*MockTaskEngineMockRecorder) MustInit

func (mr *MockTaskEngineMockRecorder) MustInit(arg0 interface{}) *gomock.Call

MustInit indicates an expected call of MustInit

func (*MockTaskEngineMockRecorder) SetSaver

func (mr *MockTaskEngineMockRecorder) SetSaver(arg0 interface{}) *gomock.Call

SetSaver indicates an expected call of SetSaver

func (*MockTaskEngineMockRecorder) StateChangeEvents

func (mr *MockTaskEngineMockRecorder) StateChangeEvents() *gomock.Call

StateChangeEvents indicates an expected call of StateChangeEvents

func (*MockTaskEngineMockRecorder) UnmarshalJSON

func (mr *MockTaskEngineMockRecorder) UnmarshalJSON(arg0 interface{}) *gomock.Call

UnmarshalJSON indicates an expected call of UnmarshalJSON

func (*MockTaskEngineMockRecorder) Version

func (mr *MockTaskEngineMockRecorder) Version() *gomock.Call

Version indicates an expected call of Version

type OutOfMemoryError added in v1.1.0

type OutOfMemoryError struct{}

OutOfMemoryError is a type for errors caused by running out of memory

func (OutOfMemoryError) Error added in v1.1.0

func (err OutOfMemoryError) Error() string

func (OutOfMemoryError) ErrorName added in v1.1.0

func (err OutOfMemoryError) ErrorName() string

ErrorName returns the name of the error

type TaskDependencyError

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

TaskDependencyError is the error for task that dependencies can't be resolved

func (TaskDependencyError) Error

func (err TaskDependencyError) Error() string

func (TaskDependencyError) ErrorName

func (err TaskDependencyError) ErrorName() string

ErrorName is the name of the error

type TaskEngine

type TaskEngine interface {
	Init(context.Context) error
	MustInit(context.Context)
	// Disable *must* only be called when this engine will no longer be used
	// (e.g. right before exiting down the process). It will irreversably stop
	// this task engine from processing new tasks
	Disable()

	// StateChangeEvents will provide information about tasks that have been previously
	// executed. Specifically, it will provide information when they reach
	// running or stopped, as well as providing portbinding and other metadata
	StateChangeEvents() chan statechange.Event
	SetSaver(statemanager.Saver)

	// AddTask adds a new task to the task engine and manages its container's
	// lifecycle. If it returns an error, the task was not added.
	AddTask(*api.Task) error

	// ListTasks lists all the tasks being managed by the TaskEngine.
	ListTasks() ([]*api.Task, error)

	// GetTaskByArn gets a managed task, given a task arn.
	GetTaskByArn(string) (*api.Task, bool)

	Version() (string, error)

	json.Marshaler
	json.Unmarshaler
}

TaskEngine is an interface for the DockerTaskEngine

func NewTaskEngine

func NewTaskEngine(cfg *config.Config, client DockerClient,
	credentialsManager credentials.Manager,
	containerChangeEventStream *eventstream.EventStream,
	imageManager ImageManager, state dockerstate.TaskEngineState,
	metadataManager containermetadata.Manager,
	resource resources.Resource) TaskEngine

NewTaskEngine returns a default TaskEngine

type TaskStoppedBeforePullBeginError added in v1.13.0

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

TaskStoppedBeforePullBeginError is a type for task errors involving pull

func (TaskStoppedBeforePullBeginError) Error added in v1.13.0

func (TaskStoppedBeforePullBeginError) ErrorName added in v1.13.0

ErrorName returns the name of the error

Directories

Path Synopsis
Package dockerauth handles storing auth configuration information for Docker registries.
Package dockerauth handles storing auth configuration information for Docker registries.
mocks
Package mock_dockerclient is a generated GoMock package.
Package mock_dockerclient is a generated GoMock package.
Package dockeriface contains an interface for go-dockerclient matching the subset used by the agent
Package dockeriface contains an interface for go-dockerclient matching the subset used by the agent
mocks
Package mock_dockeriface is a generated GoMock package.
Package mock_dockeriface is a generated GoMock package.
mocks
Package mock_dockerstate is a generated GoMock package.
Package mock_dockerstate is a generated GoMock package.
testutils
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.
Package emptyvolume contains some information related to the 'emptyvolumes'
Package emptyvolume contains some information related to the 'emptyvolumes'
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.

Jump to

Keyboard shortcuts

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