public interface SharedIndexInformer<T> extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
SharedIndexInformer<T> |
addEventHandler(ResourceEventHandler<? super T> handler)
Add event handler.
|
SharedIndexInformer<T> |
addEventHandlerWithResyncPeriod(ResourceEventHandler<? super T> handle,
long resyncPeriod)
Adds an event handler to the shared informer using the specified resync period.
|
SharedIndexInformer<T> |
addIndexers(Map<String,Function<T,List<String>>> indexers)
Add indexers
|
default void |
close() |
SharedIndexInformer<T> |
exceptionHandler(ExceptionHandler handler)
Sets the
ExceptionHandler for this informer. |
Class<T> |
getApiTypeClass()
Return the class this informer is watching
|
Indexer<T> |
getIndexer()
returns the internal indexer store.
|
Store<T> |
getStore()
Return the Store associated with this informer
|
default boolean |
hasSynced()
Return true if the informer has ever synced
|
SharedIndexInformer<T> |
initialState(Stream<T> items)
Sets the initial state of the informer store, which will
be replaced by the initial list operation.
|
boolean |
isRunning()
Return true if the informer is running
|
boolean |
isWatching()
Return true if the informer is actively watching
Will return false when isRunning() is true when the watch needs to be re-established. |
SharedIndexInformer<T> |
itemStore(ItemStore<T> itemStore) |
String |
lastSyncResourceVersion()
The resource version observed when last synced with the underlying store.
|
SharedIndexInformer<T> |
removeIndexer(String name)
Remove the named index
|
default SharedIndexInformer<T> |
removeNamespaceIndex()
Remove the namesapce index
|
SharedIndexInformer<T> |
run()
Starts the shared informer, which will be stopped when
stop() is called. |
CompletionStage<Void> |
start()
A non-blocking alternative to run.
|
void |
stop()
Stops the shared informer.
|
CompletionStage<Void> |
stopped()
Return a
CompletionStage that will allow notification of the informer stopping. |
SharedIndexInformer<T> addIndexers(Map<String,Function<T,List<String>>> indexers)
indexers - indexersdefault SharedIndexInformer<T> removeNamespaceIndex()
SharedIndexInformer<T> removeIndexer(String name)
name - Indexer<T> getIndexer()
SharedIndexInformer<T> addEventHandler(ResourceEventHandler<? super T> handler)
The handler methods will be called using the client's Executor
handler - event handlerSharedIndexInformer<T> addEventHandlerWithResyncPeriod(ResourceEventHandler<? super T> handle, long resyncPeriod)
The handler methods will be called using the client's Executor
handle - the event handlerresyncPeriod - the specific resync periodSharedIndexInformer<T> run()
stop() is called.
void stop()
Once this call completes the informer will stop processing events, but the underlying watch closure may not yet be completed
default void close()
close in interface AutoCloseabledefault boolean hasSynced()
String lastSyncResourceVersion()
Since the store processes events asynchronously this value should not be used as an indication of the last resourceVersion seen. Also after an informer is stopped any pending event processing may not happen.
boolean isRunning()
See also stopped()
boolean isWatching()
isRunning() is true when the watch needs to be re-established.SharedIndexInformer<T> initialState(Stream<T> items)
items - SharedIndexInformer<T> itemStore(ItemStore<T> itemStore)
CompletionStage<Void> start()
stop() is
called.
By default the informer will attempt only a single start attempt. Use exceptionHandler(ExceptionHandler) to
modify this behavior.
SharedIndexInformer<T> exceptionHandler(ExceptionHandler handler)
ExceptionHandler for this informer. For example, exceptionHandler((b, t) -> true)), will
keep retrying no matter what the exception is.
May only be called prior to the informer starting
handler - CompletionStage<Void> stopped()
CompletionStage that will allow notification of the informer stopping. This will be completed after
event processing has stopped.
If stop() is called, the CompletionStage will complete normally.
If an exception occurs that terminates the informer, then it will be exceptionally completed with that exception
- typically a WatcherException
Copyright © 2015–2023 Red Hat. All rights reserved.