events

package
v0.13.1-dev Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2015 License: Apache-2.0 Imports: 5 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 Event

type Event struct {
	// the absolute container name for which the event occurred
	ContainerName string
	// the time at which the event occurred
	Timestamp time.Time
	// the type of event. EventType is an enumerated type
	EventType EventType
	// the original event object and all of its extraneous data, ex. an
	// OomInstance
	EventData EventDataInterface
}

Event contains information general to events such as the time at which they occurred, their specific type, and the actual event. Event types are differentiated by the EventType field of Event.

type EventDataInterface

type EventDataInterface interface {
}

a general interface which populates the Event field EventData. The actual object, such as an OomInstance, is set as an Event's EventData

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(outChannel chan *Event, request *Request) 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 *Event) error
}

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

type EventSlice

type EventSlice []*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 EventType

type EventType int

EventType is an enumerated type which lists the categories under which events may fall. The Event field EventType is populated by this enum.

const (
	TypeOom EventType = iota
	TypeContainerCreation
	TypeContainerDeletion
)

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