pub struct MultiStore<K>{ /* private fields */ }Expand description
A reflector view over one or more namespace-scoped watches.
When the operator runs cluster-wide (NamespaceScope::All) this holds exactly
one shard built from Api::all, and every operation is a direct pass-through —
the cluster-wide deployment behaves exactly as it did before namespace scoping
existed.
When the operator is scoped to a namespace set it holds one shard per
namespace. That sharding is load-bearing, not an implementation detail: a
single reflector Store cannot be fed by several namespace watches merged with
select_all, because watcher::Event::InitDone makes the store replace its
entire contents with the buffer of whichever watch just finished listing
(kube_runtime::reflector::store does mem::swap(&mut *store, &mut self.buffer)).
Merging N watches into one writer would leave the store holding only the last
namespace to sync — silently, and again on every watch reconnect. Sharding keeps
each watch’s Init/InitDone cycle confined to its own store.
Implementations§
Source§impl<K> MultiStore<K>
impl<K> MultiStore<K>
Sourcepub fn new(shards: Vec<Store<K>>) -> Self
pub fn new(shards: Vec<Store<K>>) -> Self
Build a view over the given shards.
§Panics
Panics if shards is empty. An empty view would make every lookup return
nothing while the operator reported itself healthy — a far worse failure
than a loud one at startup.
Sourcepub fn state(&self) -> Vec<Arc<K>>
pub fn state(&self) -> Vec<Arc<K>>
All objects across every shard.
Shards are disjoint by construction (one namespace each, or a single cluster-wide shard), so no de-duplication is needed.
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Number of shards backing this view (1 when cluster-wide).
Trait Implementations§
Source§impl<K> Clone for MultiStore<K>
impl<K> Clone for MultiStore<K>
Source§fn clone(&self) -> MultiStore<K>
fn clone(&self) -> MultiStore<K>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<K> Freeze for MultiStore<K>
impl<K> !RefUnwindSafe for MultiStore<K>
impl<K> Send for MultiStore<K>
impl<K> Sync for MultiStore<K>
impl<K> Unpin for MultiStore<K>
impl<K> !UnwindSafe for MultiStore<K>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].