watcher

package
v0.0.0-...-4f86690 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerAdaptor

type ContainerAdaptor struct {
	// contains filtered or unexported fields
}

ContainerAdaptor is an Adaptator for ContainerJSON

func NewContainerAdaptor

func NewContainerAdaptor(container *types.ContainerJSON) *ContainerAdaptor

NewContainerAdaptor return an Adaptator

func (*ContainerAdaptor) Field

func (ca *ContainerAdaptor) Field(fieldpath []string) (value string, present bool)

Field implements Adaptator interface

type State

type State struct {
	// contains filtered or unexported fields
}

State manage containers as a CRUD

func NewState

func NewState(socketContainerd, socketDocker string) (*State, error)

NewState returns a new State

func (*State) HandleCreate

func (s *State) HandleCreate(filter string, handler func(*types.ContainerJSON)) error

HandleCreate handles create events

func (*State) HandleDelete

func (s *State) HandleDelete(filter string, handler func(*types.ContainerJSON)) error

HandleDelete handles delete events

func (*State) Listen

func (s *State) Listen(ctxw context.Context) error

Listen looks for already existing containers and watch for events

type Watcher

type Watcher struct {
	Container *containerd.Client
	Docker    *client.Client
	// contains filtered or unexported fields
}

Watcher watch the watchmen Watch Containerd for Docker events

func New

func New(socketContainerd, socketDocker string) (*Watcher, error)

New Watcher

func (*Watcher) HandleDelete

func (w *Watcher) HandleDelete(filter string, handler func(*types.ContainerJSON, *_events.TaskDelete)) error

HandleDelete handles delete

func (*Watcher) HandleExit

func (w *Watcher) HandleExit(filter string, handler func(*types.ContainerJSON, *_events.TaskExit)) error

HandleExit handles exit

func (*Watcher) HandleStart

func (w *Watcher) HandleStart(filter string, handler func(*types.ContainerJSON, *_events.TaskStart)) error

HandleStart handles start

func (*Watcher) Listen

func (w *Watcher) Listen(ctxw context.Context)

Listen events

func (*Watcher) Version

func (w *Watcher) Version() (containerd.Version, error)

Version of containerd

Jump to

Keyboard shortcuts

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