Package io.kubernetes.client.informer
Interface SharedInformer<ApiType extends io.kubernetes.client.common.KubernetesObject>
- All Known Subinterfaces:
SharedIndexInformer<ApiType>
- All Known Implementing Classes:
DefaultSharedIndexInformer
public interface SharedInformer<ApiType extends io.kubernetes.client.common.KubernetesObject>
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventHandler(ResourceEventHandler<ApiType> handler) Add event handler.voidaddEventHandlerWithResyncPeriod(ResourceEventHandler<ApiType> handler, long resyncPeriod) addEventHandlerWithResyncPeriod adds an event handler to the shared informer using the specified resync period.booleanhasSynced returns true if the shared informer's store has synced.Last sync resource version string.voidrun()run starts the shared informer, which will be stopped until stop() is called.voidsetTransform(TransformFunc transformFunc) The TransformFunc is called for each object which is about to be stored.voidstop()stop stops the shared informer.
-
Method Details
-
addEventHandler
Add event handler.- Parameters:
handler- the handler
-
addEventHandlerWithResyncPeriod
addEventHandlerWithResyncPeriod adds an event handler to the shared informer using the specified resync period. Events to a single handler are delivered sequentially, but there is no coordination between different handlers.- Parameters:
handler- the event handlerresyncPeriod- the specific resync period
-
run
void run()run starts the shared informer, which will be stopped until stop() is called. -
stop
void stop()stop stops the shared informer. -
hasSynced
boolean hasSynced()hasSynced returns true if the shared informer's store has synced. -
lastSyncResourceVersion
String lastSyncResourceVersion()Last sync resource version string.- Returns:
- the string
-
setTransform
The TransformFunc is called for each object which is about to be stored. This function is intended for you to take the opportunity to remove, transform, or normalize fields. One use case is to strip unused metadata fields out of objects to save on RAM cost.Must be set before starting the informer.
Note: Since the object given to the handler may be already shared with other goroutines, it is advisable to copy the object being transform before mutating it at all and returning the copy to prevent data races.
- Parameters:
transformFunc- the transform function
-