[−][src]Struct kube::runtime::Informer
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]
K: Clone + DeserializeOwned + Meta,
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]
&'_ self
) -> Result<impl Stream<Item = Result<WatchEvent<K>>>>
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
Auto Trait Implementations
impl<K> !RefUnwindSafe for Informer<K>
impl<K> Send for Informer<K> where
K: Send,
K: Send,
impl<K> Sync for Informer<K> where
K: Sync,
K: Sync,
impl<K> Unpin for Informer<K> where
K: Unpin,
K: Unpin,
impl<K> !UnwindSafe for Informer<K>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,