monitor

package
v0.0.0-...-36f1a77 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2016 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerEvent

type DockerEvent string

DockerEvent is the type of various docker events.

const (
	// DockerEventStart represents the Docker "start" event.
	DockerEventStart DockerEvent = "start"

	// DockerEventDie represents the Docker "die" event.
	DockerEventDie DockerEvent = "die"

	// DockerEventDestroy represents the Docker "destroy" event.
	DockerEventDestroy DockerEvent = "destroy"

	// DockerEventConnect represents the Docker "connect" event.
	DockerEventConnect DockerEvent = "connect"

	// DockerClientVersion is the version sent out as the client
	DockerClientVersion = "v1.23"
)

type DockerEventHandler

type DockerEventHandler func(event *events.Message) error

A DockerEventHandler is type of docker event handler functions.

type DockerMetadataExtractor

type DockerMetadataExtractor func(*types.ContainerJSON) (*policy.PURuntime, error)

A DockerMetadataExtractor is a function used to extract a *policy.PURuntime from a given docker ContainerJSON.

type Monitor

type Monitor interface {

	// Start starts the monitor.
	Start() error

	// Stop Stops the monitor.
	Stop() error
}

A Monitor is the interface to implement low level monitoring functions on some well defined primitive.

func NewDockerMonitor

func NewDockerMonitor(
	socketType string,
	socketAddress string,
	p ProcessingUnitsHandler,
	m DockerMetadataExtractor,
	l collector.EventCollector, syncAtStart bool,
) Monitor

NewDockerMonitor returns a pointer to a DockerMonitor initialized with the given socketType ('tcp' or 'unix') and socketAddress (a port for 'tcp' or a socket file for 'unix').

After creating a new DockerMonitor, call addHandler to install one or more callback handlers for the events to monitor. Then call Start.

type ProcessingUnitsHandler

type ProcessingUnitsHandler interface {

	// HandleCreate handles the create ProcessingUnit event.
	HandleCreate(contextID string, runtimeInfo *policy.PURuntime) <-chan error

	// HandleDelete handles the delete ProcessingUnit event.
	HandleDelete(contextID string) <-chan error

	// HandleDelete handles the delete ProcessingUnit event.
	HandleDestroy(contextID string) <-chan error
}

A ProcessingUnitsHandler is responsible for monitoring creation and deletion of ProcessingUnits.

type TestMonitor

type TestMonitor interface {
	Monitor
	MockStart(t *testing.T, impl func() error)
	MockStop(t *testing.T, impl func() error)
}

TestMonitor us

func NewTestMonitor

func NewTestMonitor() TestMonitor

NewTestMonitor returns a new TestManipulator.

Jump to

Keyboard shortcuts

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