[−][src]Struct kube::runtime::Reflector
A reflection of Resource
state in kubernetes
This watches and caches a Resource<K>
by:
- seeding the cache from a large initial list call
- keeping track of initial, and subsequent resourceVersions
- recovering when resourceVersions get desynced
It exposes it's internal state readably through a getter.
Methods
impl<K> Reflector<K> where
K: Clone + DeserializeOwned + Meta + Send,
[src]
K: Clone + DeserializeOwned + Meta + Send,
pub fn new(client: APIClient, lp: ListParams, r: Resource) -> Self
[src]
Create a reflector with a kube client on a resource
pub async fn init(self) -> Result<Self>
[src]
Initializes with a full list of data from a large initial LIST call
pub async fn poll<'_>(&'_ self) -> Result<()>
[src]
Run a single watch poll
If this returns an error, it tries a full refresh. This is meant to be run continually in a thread/task. Spawn one.
pub async fn state<'_>(&'_ self) -> Result<Vec<K>>
[src]
Read data for users of the reflector
This is instant if you are reading and writing from the same context.
pub fn get(&self, name: &str) -> Result<Option<K>>
[src]
Read a single entry by name
Will read in the configured namsepace, or globally on non-namespaced reflectors.
If you are using a non-namespaced resources with name clashes,
Try Reflector::get_within
instead.
pub fn get_within(&self, name: &str, ns: &str) -> Result<Option<K>>
[src]
Read a single entry by name within a specific namespace
This is a more specific version of Reflector::get
.
This is only useful if your reflector is configured to poll across namsepaces.
pub async fn reset<'_>(&'_ self) -> Result<()>
[src]
Reset the state with a full LIST call
Same as what is done in State::new
.
Trait Implementations
Auto Trait Implementations
impl<K> !RefUnwindSafe for Reflector<K>
impl<K> Send for Reflector<K>
impl<K> Sync for Reflector<K>
impl<K> Unpin for Reflector<K>
impl<K> !UnwindSafe for Reflector<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>,