events

package
v0.0.0-...-318252a Latest Latest
Warning

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

Go to latest
Published: Apr 1, 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

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

func NewEventChannel

func NewEventChannel(watchId int) *EventChannel

func (*EventChannel) GetChannel

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

func (*EventChannel) GetWatchId

func (self *EventChannel) GetWatchId() int

type EventManager

type EventManager interface {
	// Watch checks if events fed to it by the caller of AddEvent satisfy the
	// request and if so sends the event back to the caller on outChannel
	WatchEvents(request *Request) (*EventChannel, error)
	// GetEvents() returns a slice of all events detected that have passed
	// the *Request object parameters to the caller
	GetEvents(request *Request) (EventSlice, error)
	// AddEvent allows the caller to add an event to an EventManager
	// object
	AddEvent(e *info.Event) error
	// Removes a watch instance from the EventManager's watchers map
	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

typedef of a slice of Event pointers

func (EventSlice) Len

func (e EventSlice) Len() int

function necessary to implement the sort interface on the Events struct

func (EventSlice) Less

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

function necessary to implement the sort interface on the Events struct

func (EventSlice) Swap

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

function necessary to implement the sort interface on the Events struct

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 they 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