events

package
v2.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandler

type EventHandler interface {
	HandleEvent(any interface{}) error
}

type EventMonitor

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

EventMonitor monitors containerd event and updates internal state correspondingly.

func NewEventMonitor

func NewEventMonitor(eventHandler EventHandler) *EventMonitor

NewEventMonitor create new event monitor. New event monitor will Start subscribing containerd event. All events happen after it should be monitored.

func (*EventMonitor) Backoff

func (em *EventMonitor) Backoff(key string, evt interface{})

func (*EventMonitor) Start

func (em *EventMonitor) Start() <-chan error

Start starts the event monitor which monitors and handles all subscribed events. It returns an error channel for the caller to wait for Stop errors from the event monitor.

NOTE:

  1. Start must be called after Subscribe.
  2. The task exit event has been handled in individual startSandboxExitMonitor or startContainerExitMonitor goroutine at the first. If the goroutine fails, it puts the event into backoff retry queue and event monitor will handle it later.

func (*EventMonitor) Stop

func (em *EventMonitor) Stop()

Stop stops the event monitor. It will close the event channel. Once event monitor is stopped, it can't be started.

func (*EventMonitor) Subscribe

func (em *EventMonitor) Subscribe(subscriber events.Subscriber, filters []string)

Subscribe starts to Subscribe containerd events.

Jump to

Keyboard shortcuts

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