events

package
v0.0.0-...-1d8dca5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const EventsManagerServiceLocalID = "updatem.service.local.v1.service-events-manager"

EventsManagerServiceLocalID is the ID used by the service in the local services registry

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// the EventType
	Type EventType `json:"type"`
	// the EventAction
	Action EventAction `json:"action"`
	// the instance that changed
	Source interface{} `json:"source,omitempty"`
	// time
	Time int64 `json:"time,omitempty"`
	// event context
	Context context.Context `json:"context"`
	// error information about the event
	Error error `json:"error"`
}

Event represents an emitted event

type EventAction

type EventAction string

EventAction represents the event's action

const (
	// EventActionResourcesAdded is used when a Pod or Node resource is added
	EventActionResourcesAdded EventAction = "added"
	// EventActionResourcesUpdated is used when a Pod or Node resource is updated
	EventActionResourcesUpdated EventAction = "updated"
	// EventActionResourcesDeleted is used when a Pod or Node resource is deleted
	EventActionResourcesDeleted EventAction = "deleted"
)

type EventType

type EventType string

EventType represents the event's type

const (
	// EventTypeResources is an event type for the resources
	EventTypeResources EventType = "resources"
)

type UpdateEventsManager

type UpdateEventsManager interface {
	// Publish adds a new event to be dispatched based on the provided EventType and EventAction
	Publish(ctx context.Context, event *Event) error
	// Subscribe provides two channels where the according events and errors can be received via the subscriber context provided
	Subscribe(ctx context.Context) (<-chan *Event, <-chan error)
}

UpdateEventsManager provies a simple way of publishing and subscribing to update manager related events.

Jump to

Keyboard shortcuts

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