events

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AllEvents       = "all-events"
	NodeCleaning    = "node-cleaning"
	NodeCreated     = "node-created"
	NodePurged      = "node-purged"
	NodeRunning     = "node-running"
	PodCreated      = "pod-created"
	PodEjected      = "pod-ejected" // We found a lost node with a bound pod
	PodRunning      = "pod-running"
	PodShouldDelete = "pod-should-delete"
	PodTerminated   = "pod-terminated"
	PodUpdated      = "pod-updated"
	SecretCreated   = "secret-created"
	SecretDeleted   = "secret-deleted"
	SecretUpdated   = "secret-updated"
	ServiceCreated  = "service-created"
	ServiceDeleted  = "service-deleted"
	ServiceUpdated  = "service-updated"
	StartSpotFailed = "start-spot-failed"
	UsageCreated    = "usage-created"
)

Variables

View Source
var ArbitraryChanSize = 10000

Functions

This section is empty.

Types

type Event

type Event struct {
	Status  string
	Source  string
	Message string
	Object  interface{}
}

type EventHandler

type EventHandler interface {
	Handle(Event) error
}

type EventSystem

type EventSystem struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewEventSystem

func NewEventSystem(quit <-chan struct{}, wg *sync.WaitGroup) *EventSystem

func (*EventSystem) Emit

func (es *EventSystem) Emit(status, source string, obj interface{}, args ...interface{})

func (*EventSystem) RegisterHandler

func (es *EventSystem) RegisterHandler(status string, h EventHandler)

At this time, you can't unregister from an event Why? Because we don't need that functionality yet If you need that functionality, feel free to add it

func (*EventSystem) RegisterHandlerFunc

func (es *EventSystem) RegisterHandlerFunc(status string, h func(Event) error)

func (*EventSystem) Run

func (es *EventSystem) Run(quit <-chan struct{}, wg *sync.WaitGroup)

type HandlerFunc

type HandlerFunc func(Event) error

Copy net/http's ability to register any function as a handler for an event

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(e Event) error

Jump to

Keyboard shortcuts

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