engineclient

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 2 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

This section is empty.

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

	// 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.

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