events

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartRouter

func StartRouter(router Router, handler Handler)

StartRouter calls the listener function and takes the interface for testing

Types

type DockerEventRouter

type DockerEventRouter struct {
	DockerClient *client.Client
	Handler      Handler
}

DockerEventRouter is the Docker event handler implementation

func (DockerEventRouter) Listen

func (de DockerEventRouter) Listen(ctx context.Context) (<-chan events.Message, <-chan error)

Listen implements the Router interface

type DockerHandler

type DockerHandler struct {
	Crontab *cron.Crontab
}

DockerHandler handles docker messages

func NewDockerHandler

func NewDockerHandler(opts *DockerHandlerOpts) (*DockerHandler, error)

NewDockerHandler returns a docker handler with crontab

func (DockerHandler) GetJobStats added in v0.3.0

func (dh DockerHandler) GetJobStats(guage *prometheus.GaugeVec) (*prometheus.GaugeVec, error)

func (DockerHandler) Handle

func (dh DockerHandler) Handle(msg Message)

Handle implements handler interface

type DockerHandlerOpts added in v0.3.0

type DockerHandlerOpts struct {
	RancherMode bool
	MetadataURL string
}

type Handler

type Handler interface {
	Handle(Message)
}

Handler handles messages

type Message

type Message *events.Message

Message is a message from an event stream

type Router

type Router interface {
	Listen(context.Context) (<-chan events.Message, <-chan error)
}

Router Interface

func NewEventRouter

func NewEventRouter() (Router, error)

NewEventRouter returns the a Docker event handler

Jump to

Keyboard shortcuts

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