record

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package record has all client logic for recording and reporting events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Event

func Event(object runtime.Object, reason, message string)

Event constructs an event from the given information and puts it in the queue for sending. 'object' is the object this event is about. Event will make a reference-- or you may also pass a reference to the object directly. 'reason' is the reason this event is generated. 'reason' should be short and unique; it will be used to automate handling of events, so imagine people writing switch statements to handle them. You want to make that easy. 'message' is intended to be human readable.

The resulting event will be created in the same namespace as the reference object.

func Eventf

func Eventf(object runtime.Object, reason, messageFmt string, args ...interface{})

Eventf is just like Event, but with Sprintf for the message field.

func GetEvents

func GetEvents(f func(*api.Event)) watch.Interface

GetEvents lets you see *local* events. Convenience function for testing. The return value can be ignored or used to stop logging, if desired.

func StartLogging

func StartLogging(logf func(format string, args ...interface{})) watch.Interface

StartLogging just logs local events, using the given logging function. The return value can be ignored or used to stop logging, if desired.

func StartRecording

func StartRecording(recorder EventRecorder, source api.EventSource) watch.Interface

StartRecording starts sending events to recorder. Call once while initializing your binary. Subsequent calls will be ignored. The return value can be ignored or used to stop recording, if desired. TODO: make me an object with parameterizable queue length and retry interval

Types

type EventRecorder

type EventRecorder interface {
	Create(event *api.Event) (*api.Event, error)
	Update(event *api.Event) (*api.Event, error)
}

EventRecorder knows how to store events (client.Client implements it.) EventRecorder must respect the namespace that will be embedded in 'event'. It is assumed that EventRecorder will return the same sorts of errors as pkg/client's REST client.

type History added in v0.3.2

type History struct {
	// The number of times the event has occured since first occurance.
	Count int

	// The time at which the event was first recorded.
	FirstTimestamp util.Time

	// The unique name of the first occurance of this event
	Name string

	// Resource version returned from previous interaction with server
	ResourceVersion string
}

func AddOrUpdateEvent added in v0.3.2

func AddOrUpdateEvent(newEvent *api.Event) History

AddOrUpdateEvent creates a new entry for the given event in the previous events hash table if the event doesn't already exist, otherwise it updates the existing entry.

func GetEvent added in v0.3.2

func GetEvent(event *api.Event) History

GetEvent returns the entry corresponding to the given event, if one exists, otherwise a History object with a count of 1 is returned.

Jump to

Keyboard shortcuts

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