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 ¶
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
IsProcesslessContainer returns true if the specified error is an ProcesslessContainerErr.
func NewProcesslessContainerError ¶ added in v0.4.8
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 // Version information about the engine. Version(ctx context.Context) 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 inspecting container details failed because it was a container without any process (yet or anymore), such as a container freshly created, and yet not started.
This usually happens due to transient changes between listing containers or processing lifecycle-related events and inspecting them, because there are no atomic operations available (and strictly necessary). There are already checks in place that usually avoid this error in static situations, but they can never give one hundred percent garantuees.
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. |