events

package
v0.4.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventManager

func NewEventManager() *events

returns a pointer to an initialized Events object

Types

type EventChannel added in v0.4.4

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

func NewEventChannel added in v0.4.4

func NewEventChannel(watchId int) *EventChannel

func (*EventChannel) GetChannel added in v0.4.4

func (self *EventChannel) GetChannel() chan *info.Event

func (*EventChannel) GetWatchId added in v0.4.4

func (self *EventChannel) GetWatchId() int

type EventManager

type EventManager interface {
	// WatchEvents() allows a caller to register for receiving events based on the specified request.
	// On successful registration, an EventChannel object is returned.
	WatchEvents(request *Request) (*EventChannel, error)
	// GetEvents() returns all detected events based on the filters specified in request.
	GetEvents(request *Request) (EventSlice, error)
	// AddEvent allows the caller to add an event to an EventManager
	// object
	AddEvent(e *info.Event) error
	// Cancels a previously requested watch event.
	StopWatch(watch_id int)
}

EventManager is implemented by Events. It provides two ways to monitor events and one way to add events

type EventSlice

type EventSlice []*info.Event

func (EventSlice) Len

func (e EventSlice) Len() int

functions necessary to implement the sort interface on the Events struct

func (EventSlice) Less

func (e EventSlice) Less(i, j int) bool

func (EventSlice) Swap

func (e EventSlice) Swap(i, j int)

type Request

type Request struct {
	// events falling before StartTime do not satisfy the request. StartTime
	// must be left blank in calls to WatchEvents
	StartTime time.Time
	// events falling after EndTime do not satisfy the request. EndTime
	// must be left blank in calls to WatchEvents
	EndTime time.Time
	// EventType is a map that specifies the type(s) of events wanted
	EventType map[info.EventType]bool
	// allows the caller to put a limit on how many
	// events to receive. If there are more events than MaxEventsReturned
	// then the most chronologically recent events in the time period
	// specified are returned. Must be >= 1
	MaxEventsReturned int
	// the absolute container name for which the event occurred
	ContainerName string
	// if IncludeSubcontainers is false, only events occurring in the specific
	// container, and not the subcontainers, will be returned
	IncludeSubcontainers bool
}

Request holds a set of parameters by which Event objects may be screened. The caller may want events that occurred within a specific timeframe or of a certain type, which may be specified in the *Request object they pass to an EventManager function

func NewRequest

func NewRequest() *Request

returns a pointer to an initialized Request object

Jump to

Keyboard shortcuts

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