Skip to content

Commit

Permalink
Fix minor broken doc links and add missing feature flag (#1471)
Browse files Browse the repository at this point in the history
* Fix minor broken doc links and add missing feature flag

Signed-off-by: clux <[email protected]>

* suggestion + another broken link

Signed-off-by: clux <[email protected]>

---------

Signed-off-by: clux <[email protected]>
  • Loading branch information
clux authored Apr 19, 2024
1 parent c89a419 commit 79d23a0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
17 changes: 16 additions & 1 deletion kube-runtime/src/reflector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub use store::{store, Store};

/// Cache objects from a [`watcher()`] stream into a local [`Store`]
///
/// Observes the raw [`Stream`] of [`watcher::Event`] objects, and modifies the cache.
/// Observes the raw `Stream` of [`watcher::Event`] objects, and modifies the cache.
/// It passes the raw [`watcher()`] stream through unmodified.
///
/// ## Usage
Expand Down Expand Up @@ -98,6 +98,21 @@ pub use store::{store, Store};
/// Additionally, only `labels`, `annotations` and `managed_fields` are safe to drop from `ObjectMeta`.
///
/// For more information check out: <https://kube.rs/controllers/optimization/> for graphs and techniques.
///
/// ## Stream sharing
///
/// `reflector()` as an interface may optionally create a stream that can be
/// shared with other components to help with resource usage.
///
/// To share a stream, the `Writer<K>` consumed by `reflector()` must be
/// created through an interface that allows a store to be subscribed on, such
/// as [`store_shared()`]. When the store supports being subscribed on, it will
/// broadcast an event to all active listeners after caching any object
/// contained in the event.
///
/// Creating subscribers requires an
/// [`unstable`](https://github.com/kube-rs/kube/blob/main/kube-runtime/Cargo.toml#L17-L21)
/// feature
pub fn reflector<K, W>(mut writer: store::Writer<K>, stream: W) -> impl Stream<Item = W::Item>
where
K: Lookup + Clone,
Expand Down
4 changes: 4 additions & 0 deletions kube-runtime/src/reflector/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ where
///
/// Multiple subscribe handles may be obtained, by either calling
/// `subscribe` multiple times, or by calling `clone()`
///
/// This function returns a `Some` when the [`Writer`] is constructed through
/// [`Writer::new_shared`] or [`store_shared`], and a `None` otherwise.
#[cfg(feature = "unstable-runtime-subscribe")]
pub fn subscribe(&self) -> Option<ReflectHandle<K>> {
self.dispatcher
.as_ref()
Expand Down
4 changes: 2 additions & 2 deletions kube-runtime/src/scheduler.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Delays and deduplicates [`Stream`] items
//! Delays and deduplicates [`Stream`](futures::stream::Stream) items

use futures::{stream::Fuse, Stream, StreamExt};
use hashbrown::{hash_map::Entry, HashMap};
Expand Down Expand Up @@ -251,7 +251,7 @@ where
}
}

/// Stream transformer that delays and deduplicates [`Stream`] items.
/// Stream transformer that delays and deduplicates items.
///
/// Items are deduplicated: if an item is submitted multiple times before being emitted then it will only be
/// emitted at the earliest `Instant`.
Expand Down
2 changes: 2 additions & 0 deletions kube-runtime/src/utils/watch_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ pub trait WatchStreamExt: Stream {
///
///
/// [`Store`]: crate::reflector::Store
/// [`subscribe()`]: crate::reflector::store::Writer::subscribe()
/// [`Stream`]: futures::stream::Stream
/// [`ReflectHandle`]: crate::reflector::dispatcher::ReflectHandle
/// ## Usage
/// ```no_run
Expand Down

0 comments on commit 79d23a0

Please sign in to comment.