kube_runtime::utils

Trait Predicate

source
pub trait Predicate<K> {
    // Required method
    fn hash_property(&self, obj: &K) -> Option<u64>;

    // Provided methods
    fn fallback<F: Predicate<K>>(self, f: F) -> Fallback<Self, F>
       where Self: Sized { ... }
    fn combine<F: Predicate<K>>(self, f: F) -> Combine<Self, F>
       where Self: Sized { ... }
}
Expand description

A predicate is a hasher of Kubernetes objects stream filtering

Required Methods§

source

fn hash_property(&self, obj: &K) -> Option<u64>

A predicate only needs to implement optional hashing when keys exist

Provided Methods§

source

fn fallback<F: Predicate<K>>(self, f: F) -> Fallback<Self, F>
where Self: Sized,

Returns a Predicate that falls back to an alternate property if the first does not exist

§Usage
use kube::runtime::{predicates, Predicate};
let pred = predicates::generation.fallback(predicates::resource_version);
blah::<Pod>(pred);
source

fn combine<F: Predicate<K>>(self, f: F) -> Combine<Self, F>
where Self: Sized,

Returns a Predicate that combines all available hashes

§Usage
use kube::runtime::{predicates, Predicate};
let pred = predicates::labels.combine(predicates::annotations);
blah::<Pod>(pred);

Implementors§

source§

impl<K, F: Fn(&K) -> Option<u64>> Predicate<K> for F