events

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package events is a general definition of an event type to be passed through channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceResponse

type DeviceResponse interface {
	Event
	ChangeID() string
	Error() error
	Response() string
}

DeviceResponse a response event

func NewDeviceConnectedEvent

func NewDeviceConnectedEvent(eventType EventType, subject string) DeviceResponse

NewDeviceConnectedEvent creates a new response event object

func NewErrorEventNoChangeID

func NewErrorEventNoChangeID(eventType EventType, subject string, err error) DeviceResponse

NewErrorEventNoChangeID creates a new error event object with no changeID attached

func NewResponseEvent

func NewResponseEvent(eventType EventType, subject string, changeID devicechange.ID, response string) DeviceResponse

NewResponseEvent creates a new response event object

type Event

type Event interface {
	Subject() string
	Time() time.Time
	EventType() EventType
	Object() interface{}
	fmt.Stringer
}

Event is a general purpose base type of event Specializations of Event are possible by extending the interface See configEvent for more details

func NewEvent

func NewEvent(subject string, eventType EventType, obj interface{}) Event

NewEvent creates a new event object

type EventAction

type EventAction int

EventAction is an enumerated type

const (
	EventItemNone EventAction = iota
	EventItemAdded
	EventItemUpdated
	EventItemDeleted
)

Values of the EventItem enumeration

type EventType

type EventType int

EventType is an enumerated type

const (
	EventTypeOperationalState EventType = iota
	EventTypeDeviceConnected
	EventTypeErrorParseConfig
	EventTypeErrorDeviceConnect
	EventTypeErrorDeviceCapabilities
	EventTypeErrorDeviceConnectInitialConfigSync
	EventTypeErrorDeviceDisconnect
	EventTypeErrorSubscribe
	EventTypeErrorMissingModelPlugin
	EventTypeErrorTranslation
	EventTypeErrorGetWithRoPaths
	EventTypeTopoUpdate
)

Values of the EventType enumeration

func (EventType) String

func (et EventType) String() string

type OperationalStateEvent

type OperationalStateEvent interface {
	Event
	ItemAction() EventAction
	Path() string
	Value() *devicechange.TypedValue
}

OperationalStateEvent represents an event for an update in operational state on a device

func NewOperationalStateEvent

func NewOperationalStateEvent(subject string, path string, value *devicechange.TypedValue,
	eventAction EventAction) OperationalStateEvent

NewOperationalStateEvent creates a new operational state event object

Jump to

Keyboard shortcuts

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