Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResourceEventHandler ¶
type ResourceEventHandler interface { OnAdd(obj interface{}) OnUpdate(oldObj, newObj interface{}) OnDelete(obj interface{}) }
ResourceEventHandler can handle notifications for events that happen to a resource. The events are informational only, so you can't return an error. The handlers MUST NOT modify the objects received; this concerns not only the top level of structure but all the data structures reachable from it.
- OnAdd is called when an object is added.
- OnUpdate is called when an object is modified. Note that oldObj is the last known state of the object-- it is possible that several changes were combined together, so you can't use this to see every single change. OnUpdate is also called when a re-list happens, and it will get called even if nothing changed. This is useful for periodically evaluating or syncing something.
- OnDelete will get the final state of the item if it is known, otherwise it will get an object of type DeletedFinalStateUnknown. This can happen if the watch is closed and misses the delete event and we don't notice the deletion until the subsequent re-list.
type ResourceEventHandlerFuncs ¶
type ResourceEventHandlerFuncs struct { AddFunc func(obj interface{}) UpdateFunc func(oldObj, newObj interface{}) DeleteFunc func(obj interface{}) }
ResourceEventHandlerFuncs is an adaptor to let you easily specify as many or as few of the notification functions as you want while still implementing ResourceEventHandler. This adapter does not remove the prohibition against modifying the objects.
func (ResourceEventHandlerFuncs) OnAdd ¶
func (r ResourceEventHandlerFuncs) OnAdd(obj interface{})
OnAdd calls AddFunc if it's not nil.
func (ResourceEventHandlerFuncs) OnDelete ¶
func (r ResourceEventHandlerFuncs) OnDelete(obj interface{})
OnDelete calls DeleteFunc if it's not nil.
func (ResourceEventHandlerFuncs) OnUpdate ¶
func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{})
OnUpdate calls UpdateFunc if it's not nil.
type ResourceInformer ¶
type ResourceInformer interface { AddEventHandler(ResourceEventHandler) Run(stopCh <-chan struct{}) }
type SharedResourceInformer ¶
type SharedResourceInformer struct {
// contains filtered or unexported fields
}
func NewSharedResourceInformer ¶
func NewSharedResourceInformer(a StreamAdapter) *SharedResourceInformer
func (*SharedResourceInformer) AddEventHandler ¶
func (r *SharedResourceInformer) AddEventHandler(handler ResourceEventHandler)
func (*SharedResourceInformer) Run ¶
func (r *SharedResourceInformer) Run(stopCh <-chan struct{})
type StreamAdapter ¶
type StreamAdapter interface { AddCh() chan interface{} UpdateCh() chan Update DeleteCh() chan interface{} Close() }
func NewAgentStreamAdapter ¶
func NewAgentStreamAdapter(s api.AdminClient) StreamAdapter