[][src]Struct kube::runtime::Informer

pub struct Informer<K> where
    K: Clone + DeserializeOwned + Meta
{ /* fields omitted */ }

An event informer for a Resource

This watches a Resource<K>, by:

  • seeding the intial resourceVersion with a list call (optional)
  • keeping track of resourceVersions during every poll
  • recovering when resourceVersions get desynced

Methods

impl<K> Informer<K> where
    K: Clone + DeserializeOwned + Meta
[src]

pub fn new(client: APIClient, lp: ListParams, r: Resource) -> Self[src]

Create a reflector with a kube client on a kube resource

pub fn init_from(self, v: String) -> Self[src]

Initialize from a prior version

pub async fn poll<'_>(
    &'_ self
) -> Result<impl Stream<Item = Result<WatchEvent<K>>>>
[src]

Start a single watch stream

Opens a long polling GET and returns the complete WatchEvents as a Stream. You should always poll. When this call ends, call it again. Do not call it from more than one context.

This function will handle error handling up to a point:

  • if we go out of history (410 Gone), we reset to latest
  • if we failed an initial poll, we will retry All real errors are bubbled up, as are WachEvent::Error instances. In the retry/reset cases we wait 10s between each attempt.

If you need to track the resourceVersion you can use Informer::version().

pub async fn reset<'_>(&'_ self)[src]

Reset the resourceVersion to 0

Note: This will cause duplicate Added events for all existing resources

pub fn version(&self) -> String[src]

Return the current version

Trait Implementations

impl<K: Clone> Clone for Informer<K> where
    K: Clone + DeserializeOwned + Meta
[src]

Auto Trait Implementations

impl<K> !RefUnwindSafe for Informer<K>

impl<K> Send for Informer<K> where
    K: Send

impl<K> Sync for Informer<K> where
    K: Sync

impl<K> Unpin for Informer<K> where
    K: Unpin

impl<K> !UnwindSafe for Informer<K>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.