watcher

package
v0.0.0-...-8d1ac9d Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: BSD-3-Clause Imports: 10 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 containerd.Container) *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 string) (*State, error)

NewState returns a new State

func (*State) HandleCreate

func (s *State) HandleCreate(filter string, handler func(containerd.Container)) error

HandleCreate handles create events

func (*State) HandleDelete

func (s *State) HandleDelete(filter string, handler func(containerd.Container)) 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
	// contains filtered or unexported fields
}

Watcher watch the watchmen Watch Containerd for container events

func New

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

New Watcher

func (*Watcher) HandleDelete

func (w *Watcher) HandleDelete(filter string, handler func(containerd.Container, *_events.TaskDelete)) error

HandleDelete handles delete

func (*Watcher) HandleExit

func (w *Watcher) HandleExit(filter string, handler func(containerd.Container, *_events.TaskExit)) error

HandleExit handles exit

func (*Watcher) HandleStart

func (w *Watcher) HandleStart(filter string, handler func(containerd.Container, *_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