watcher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: Apache-2.0 Imports: 5 Imported by: 12

Documentation

Overview

Package watcher allows keeping track of the currently alive containers of a container engine.

Currently, the following container engines are supported:

- Docker - (upcoming: plain containerd with nerdctl-project awareness)

Usage

Creating container watchers for specific container engines preferably should be done using a particular container engine's NewWatcher convenience function, such as:

import "github.com/thediveo/whalewatcher/watcher/moby"
moby := NewWatcher("")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher interface {
	// Portfolio returns the current portfolio for reading. During
	// resynchronization with a container engine this can be the buffered
	// portfolio until the watcher has caught up with the new state after an
	// engine reconnect. For this reason callers must not keep the returned
	// Portfolio reference for longer periods of time, but just for what they
	// immediately need to query a Portfolio for.
	Portfolio() *whalewatcher.Portfolio
	// Ready returns a channel that gets closed after the initial
	// synchronization has been achieved. Watcher clients do not need to wait
	// for the Ready channel to get closed to work with the portfolio; this just
	// helps those applications that need to wait for results as opposed to take
	// whatever information currently is available, or not.
	Ready() <-chan struct{}
	// Watch synchronizes the Portfolio to the connected container engine's
	// state with respect to alive containers and then continuously watches for
	// changes. Watch only returns after the specified context has been
	// cancelled. It will automatically reconnect in case of loss of connection
	// to the connected container engine.
	Watch(ctx context.Context)
	// ID returns the (more or less) unique engine identifier; the exact format
	// is engine-specific.
	ID(ctx context.Context) string
	// Close cleans up and release any engine client resources, if necessary.
	Close()
}

Watcher allows keeping track of the currently alive containers of a container engine, optionally with the composer projects they're associated with (if supported).

func NewWatcher

func NewWatcher(engine engineclient.EngineClient) Watcher

NewWatcher returns a new Watcher tracking alive containers as they come and go, using the specified container EngineClient.

Directories

Path Synopsis
Package containerd provides a container Watcher for containerd engines.
Package containerd provides a container Watcher for containerd engines.
Package moby provides a container Watcher for Docker/Moby engines.
Package moby provides a container Watcher for Docker/Moby engines.

Jump to

Keyboard shortcuts

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