Skip to content

Commit

Permalink
Move pin value in examples to independent sentence
Browse files Browse the repository at this point in the history
Signed-off-by: tottoto <[email protected]>
  • Loading branch information
tottoto committed Apr 5, 2024
1 parent 902cab5 commit 75d3cdd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/event_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ async fn main() -> anyhow::Result<()> {
conf = conf.fields(&format!("regarding.kind={kind},regarding.name={name}"));
}
}
let mut event_stream = pin!(watcher(events, conf).default_backoff().applied_objects());
let event_stream = watcher(events, conf).default_backoff().applied_objects();
let mut event_stream = pin!(event_stream);

println!("{0:<6} {1:<15} {2:<55} {3}", "AGE", "REASON", "OBJECT", "MESSAGE");
while let Some(ev) = event_stream.try_next().await? {
Expand Down
5 changes: 3 additions & 2 deletions examples/node_reflector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ async fn main() -> anyhow::Result<()> {
.timeout(10); // short watch timeout in this example

let (reader, writer) = reflector::store();
let mut stream = pin!(watcher(nodes, wc)
let stream = watcher(nodes, wc)
.default_backoff()
.reflect(writer)
.applied_objects()
.predicate_filter(predicates::labels.combine(predicates::annotations))); // NB: requires an unstable feature
.predicate_filter(predicates::labels.combine(predicates::annotations)); // NB: requires an unstable feature
let mut stream = pin!(stream);

// Periodically read our state in the background
tokio::spawn(async move {
Expand Down
3 changes: 2 additions & 1 deletion examples/node_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ async fn main() -> anyhow::Result<()> {
} else {
watcher::Config::default()
};
let mut obs = pin!(watcher(nodes, wc).default_backoff().applied_objects());
let obs = watcher(nodes, wc).default_backoff().applied_objects();
let mut obs = pin!(obs);

while let Some(n) = obs.try_next().await? {
check_for_node_failures(&client, n).await?;
Expand Down
5 changes: 3 additions & 2 deletions examples/pod_reflector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() -> anyhow::Result<()> {
}
});

let mut stream = pin!(watcher(api, watcher::Config::default().any_semantic())
let stream = watcher(api, watcher::Config::default().any_semantic())
.default_backoff()
.modify(|pod| {
// memory optimization for our store - we don't care about managed fields/annotations/status
Expand All @@ -41,7 +41,8 @@ async fn main() -> anyhow::Result<()> {
})
.reflect(writer)
.applied_objects()
.predicate_filter(predicates::resource_version)); // NB: requires an unstable feature
.predicate_filter(predicates::resource_version); // NB: requires an unstable feature
let mut stream = pin!(stream);

while let Some(pod) = stream.try_next().await? {
info!("saw {}", pod.name_any());
Expand Down

0 comments on commit 75d3cdd

Please sign in to comment.