engineclient

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package engineclient defines the EngineClient interface between concrete container engine adaptor implementations and the engine-neutral watcher core.

Sub-packages implement specific container engines adaptors.

Index

Constants

View Source
const ProjectUnknown = "\000"

ProjectUnknown signals that the project name for a container event is unknown, as opposed to the zero project name.

Variables

This section is empty.

Functions

func IsProcesslessContainer added in v0.4.8

func IsProcesslessContainer(err error) bool

IsProcesslessContainer returns true if the specified error is an ProcesslessContainerErr.

func NewProcesslessContainerError added in v0.4.8

func NewProcesslessContainerError(nameorid string, typ string) error

NewProcesslessContainerError returns a new ErrProcesslessContainer, stating the type of container and its name or ID.

Types

type ContainerEvent

type ContainerEvent struct {
	Type    ContainerEventType // type of lifecycle event.
	ID      string             // ID (or name) of container.
	Project string             // optional composer project name, or zero.
}

ContainerEvent is either a container lifecycle event of a container becoming alive, having died (more precise: its process exited), paused or unpaused.

type ContainerEventType added in v0.3.0

type ContainerEventType byte

ContainerEventType identifies and enumerates the (few) container lifecycle events we're interested in, regardless of a particular container engine.

const (
	ContainerStarted ContainerEventType = iota
	ContainerExited
	ContainerPaused
	ContainerUnpaused
)

Container lifecycle events, covering only "alive" containers.

type EngineClient

type EngineClient interface {
	// List all the currently alive and kicking containers. Return errors (only)
	// in case of (severe) conntection and daemon failures that aren't
	// transparent.
	List(ctx context.Context) ([]*whalewatcher.Container, error)
	// Query (only) the subset of container details of interest to us, given the
	// name or ID of a particular container.
	Inspect(ctx context.Context, nameorid string) (*whalewatcher.Container, error)
	// Stream container lifecycle events, limited to those events in the
	// lifecycle of containers getting born (=alive, as opposed to, say,
	// "conceived", dead/gone/"sleeping") and die.
	LifecycleEvents(ctx context.Context) (<-chan ContainerEvent, <-chan error)

	// (More or less) unique engine identifier; the exact format is
	// engine-specific.
	ID(ctx context.Context) string
	// Identifier of the type of container engine, such as "docker.com",
	// "containerd.io", et cetera.
	Type() string
	// Container engine API path.
	API() string
	// Container engine PID, when known. Otherwise zero.
	PID() int

	// Underlying engine client (engine-specific).
	Client() interface{}

	// Clean up and release any engine client resources, if necessary.
	Close()
}

EngineClient defines the generic methods needed in order to watch the containers of a container engine, regardless of the specific type of engine.

type ErrProcesslessContainer added in v0.4.8

type ErrProcesslessContainer string

ErrProcesslessContainer is a custom error indicating that a container details inspection failed to be done on a container without any process, such as a container created, yet not started.

func (ErrProcesslessContainer) Error added in v0.4.8

func (err ErrProcesslessContainer) Error() string

Error returns the error message.

Directories

Path Synopsis
Package containerd implements the containerd EngineClient.
Package containerd implements the containerd EngineClient.
Package moby implements the Docker/Moby EngineClient.
Package moby implements the Docker/Moby EngineClient.

Jump to

Keyboard shortcuts

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