pub trait Exchange<T, D: ExchangeData> {
fn exchange(&self, route: impl Fn(&D) -> u64 + 'static) -> Self;
}
Expand description
Exchange records between workers.
Required Methods
sourcefn exchange(&self, route: impl Fn(&D) -> u64 + 'static) -> Self
fn exchange(&self, route: impl Fn(&D) -> u64 + 'static) -> Self
Exchange records so that all records with the same route
are at the same worker.
Examples
use timely::dataflow::operators::{ToStream, Exchange, Inspect};
timely::example(|scope| {
(0..10).to_stream(scope)
.exchange(|&x| x)
.inspect(|x| println!("seen: {:?}", x));
});