Trait differential_dataflow::input::Input
source · pub trait Input: TimelyInput {
fn new_collection<D, R>(
&mut self
) -> (InputSession<<Self as ScopeParent>::Timestamp, D, R>, Collection<Self, D, R>)
where
D: Data,
R: Diff;
fn new_collection_from<I>(
&mut self,
data: I
) -> (InputSession<<Self as ScopeParent>::Timestamp, I::Item, isize>, Collection<Self, I::Item, isize>)
where
I: IntoIterator + 'static,
I::Item: Data;
fn new_collection_from_raw<D, R, I>(
&mut self,
data: I
) -> (InputSession<<Self as ScopeParent>::Timestamp, D, R>, Collection<Self, D, R>)
where
I: IntoIterator<Item = (D, <Self as ScopeParent>::Timestamp, R)> + 'static,
D: Data,
R: Diff + Data;
}Expand description
Create a new collection and input handle to control the collection.
Required Methods
sourcefn new_collection<D, R>(
&mut self
) -> (InputSession<<Self as ScopeParent>::Timestamp, D, R>, Collection<Self, D, R>)where
D: Data,
R: Diff,
fn new_collection<D, R>(
&mut self
) -> (InputSession<<Self as ScopeParent>::Timestamp, D, R>, Collection<Self, D, R>)where
D: Data,
R: Diff,
Create a new collection and input handle to subsequently control the collection.
Examples
extern crate timely;
extern crate differential_dataflow;
use timely::Configuration;
use differential_dataflow::input::Input;
fn main() {
::timely::execute(Configuration::Thread, |worker| {
let (mut handle, probe) = worker.dataflow::<(),_,_>(|scope| {
// create input handle and collection.
let (handle, data) = scope.new_collection();
let probe = data.map(|x| x * 2)
.inspect(|x| println!("{:?}", x))
.probe();
(handle, probe)
});
handle.insert(1);
handle.insert(5);
}).unwrap();
}sourcefn new_collection_from<I>(
&mut self,
data: I
) -> (InputSession<<Self as ScopeParent>::Timestamp, I::Item, isize>, Collection<Self, I::Item, isize>)where
I: IntoIterator + 'static,
I::Item: Data,
fn new_collection_from<I>(
&mut self,
data: I
) -> (InputSession<<Self as ScopeParent>::Timestamp, I::Item, isize>, Collection<Self, I::Item, isize>)where
I: IntoIterator + 'static,
I::Item: Data,
Create a new collection and input handle from initial data.
Examples
extern crate timely;
extern crate differential_dataflow;
use timely::Configuration;
use differential_dataflow::input::Input;
fn main() {
::timely::execute(Configuration::Thread, |worker| {
let (mut handle, probe) = worker.dataflow::<(),_,_>(|scope| {
// create input handle and collection.
let (handle, data) = scope.new_collection_from(0 .. 10);
let probe = data.map(|x| x * 2)
.inspect(|x| println!("{:?}", x))
.probe();
(handle, probe)
});
handle.insert(1);
handle.insert(5);
}).unwrap();
}sourcefn new_collection_from_raw<D, R, I>(
&mut self,
data: I
) -> (InputSession<<Self as ScopeParent>::Timestamp, D, R>, Collection<Self, D, R>)where
I: IntoIterator<Item = (D, <Self as ScopeParent>::Timestamp, R)> + 'static,
D: Data,
R: Diff + Data,
fn new_collection_from_raw<D, R, I>(
&mut self,
data: I
) -> (InputSession<<Self as ScopeParent>::Timestamp, D, R>, Collection<Self, D, R>)where
I: IntoIterator<Item = (D, <Self as ScopeParent>::Timestamp, R)> + 'static,
D: Data,
R: Diff + Data,
Create a new collection and input handle from initial data.
Examples
extern crate timely;
extern crate differential_dataflow;
use timely::Configuration;
use differential_dataflow::input::Input;
fn main() {
::timely::execute(Configuration::Thread, |worker| {
let (mut handle, probe) = worker.dataflow::<(),_,_>(|scope| {
// create input handle and collection.
let (handle, data) = scope.new_collection_from(0 .. 10);
let probe = data.map(|x| x * 2)
.inspect(|x| println!("{:?}", x))
.probe();
(handle, probe)
});
handle.insert(1);
handle.insert(5);
}).unwrap();
}