pleg

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	IN_CREATE = 0x100
	IN_DELETE = 0x200
	IN_ISDIR  = 0x40000000
)

for test only

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType int
const (
	DirCreated EventType = iota
	DirRemoved
	UnknownType
)

func TypeOf

func TypeOf(event *inotify.Event) EventType

TypeOf tell the type of event

type HandlerID

type HandlerID uint32

type Pleg

type Pleg interface {
	Run(<-chan struct{}) error
	AddHandler(PodLifeCycleHandler) HandlerID
	RemoverHandler(id HandlerID) PodLifeCycleHandler
}

func NewPLEG

func NewPLEG(cgroupRootPath string) (Pleg, error)

type PodLifeCycleHandler

type PodLifeCycleHandler interface {
	OnPodAdded(podID string)
	OnPodDeleted(podID string)
	OnContainerAdded(podID, containerID string)
	OnContainerDeleted(podID, containerID string)
}

type PodLifeCycleHandlerFuncs

type PodLifeCycleHandlerFuncs struct {
	PodAddedFunc         func(podID string)
	PodDeletedFunc       func(podID string)
	ContainerAddedFunc   func(podID, containerID string)
	ContainerDeletedFunc func(podID, containerID string)
}

func (PodLifeCycleHandlerFuncs) OnContainerAdded

func (r PodLifeCycleHandlerFuncs) OnContainerAdded(podID, containerID string)

func (PodLifeCycleHandlerFuncs) OnContainerDeleted

func (r PodLifeCycleHandlerFuncs) OnContainerDeleted(podID, containerID string)

func (PodLifeCycleHandlerFuncs) OnPodAdded

func (r PodLifeCycleHandlerFuncs) OnPodAdded(podID string)

func (PodLifeCycleHandlerFuncs) OnPodDeleted

func (r PodLifeCycleHandlerFuncs) OnPodDeleted(podID string)

type Watcher

type Watcher interface {
	AddWatch(path string) error
	RemoveWatch(path string) error
	Event() chan *inotify.Event
	Error() chan error
	Close() error
}

func NewWatcher

func NewWatcher() (Watcher, error)

NewWatcher creates and returns a new inotify instance using inotify_init(2)

Jump to

Keyboard shortcuts

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