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 NewEventCache ¶
func NewEventCache() *historyCache
Types ¶
type EventBroadcaster ¶
type EventBroadcaster interface { // StartEventWatcher starts sending events received from this EventBroadcaster to the given // event handler function. The return value can be ignored or used to stop recording, if // desired. StartEventWatcher(eventHandler func(*api.Event)) watch.Interface // StartRecordingToSink starts sending events received from this EventBroadcaster to the given // sink. The return value can be ignored or used to stop recording, if desired. StartRecordingToSink(sink EventSink) watch.Interface // StartLogging starts sending events received from this EventBroadcaster to the given logging // function. The return value can be ignored or used to stop recording, if desired. StartLogging(logf func(format string, args ...interface{})) watch.Interface // NewRecorder returns an EventRecorder that can be used to send events to this EventBroadcaster // with the event source set to the given event source. NewRecorder(source api.EventSource) EventRecorder }
EventBroadcaster knows how to receive events and send them to any EventSink, watcher, or log.
type EventRecorder ¶
type EventRecorder interface { // 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 // should be in UpperCamelCase format (starting with a capital letter). "reason" 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. Event(object runtime.Object, reason, message string) // Eventf is just like Event, but with Sprintf for the message field. Eventf(object runtime.Object, reason, messageFmt string, args ...interface{}) // PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field. PastEventf(object runtime.Object, timestamp unversioned.Time, reason, messageFmt string, args ...interface{}) }
EventRecorder knows how to record events on behalf of an EventSource.
type EventSink ¶
type EventSink interface { Create(event *api.Event) (*api.Event, error) Update(event *api.Event) (*api.Event, error) Patch(oldEvent *api.Event, data []byte) (*api.Event, error) }
EventSink knows how to store events (client.Client implements it.) EventSink must respect the namespace that will be embedded in 'event'. It is assumed that EventSink will return the same sorts of errors as pkg/client's REST client.
type FakeRecorder ¶
type FakeRecorder struct {
Events []string
}
FakeRecorder is used as a fake during tests.
func (*FakeRecorder) Event ¶
func (f *FakeRecorder) Event(object runtime.Object, reason, message string)
func (*FakeRecorder) Eventf ¶
func (f *FakeRecorder) Eventf(object runtime.Object, reason, messageFmt string, args ...interface{})
func (*FakeRecorder) PastEventf ¶
func (f *FakeRecorder) PastEventf(object runtime.Object, timestamp unversioned.Time, reason, messageFmt string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.