Struct differential_dataflow::input::InputSession
source · pub struct InputSession<T: Timestamp + Clone, D: Data, R: Semigroup + 'static> { /* private fields */ }
Expand description
An input session wrapping a single timely dataflow capability.
Each timely dataflow message has a corresponding capability, which is a logical time in the
timely dataflow system. Differential dataflow updates can happen at a much higher rate than
timely dataflow’s progress tracking infrastructure supports, because the logical times are
promoted to data and updates are batched together. The InputSession
type does this batching.
§Examples
use timely::Config;
use differential_dataflow::input::Input;
::timely::execute(Config::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(3);
handle.advance_to(1);
handle.insert(5);
handle.advance_to(2);
handle.flush();
while probe.less_than(handle.time()) {
worker.step();
}
handle.remove(5);
handle.advance_to(3);
handle.flush();
while probe.less_than(handle.time()) {
worker.step();
}
}).unwrap();
Implementations§
source§impl<T: Timestamp + Clone, D: Data, R: Semigroup + 'static> InputSession<T, D, R>
impl<T: Timestamp + Clone, D: Data, R: Semigroup + 'static> InputSession<T, D, R>
sourcepub fn to_collection<G>(&mut self, scope: &mut G) -> Collection<G, D, R>where
G: ScopeParent<Timestamp = T> + TimelyInput,
pub fn to_collection<G>(&mut self, scope: &mut G) -> Collection<G, D, R>where
G: ScopeParent<Timestamp = T> + TimelyInput,
Introduces a handle as collection.
sourcepub fn from(handle: Handle<T, (D, T, R)>) -> Self
pub fn from(handle: Handle<T, (D, T, R)>) -> Self
Creates a new session from a reference to an input handle.
sourcepub fn update(&mut self, element: D, change: R)
pub fn update(&mut self, element: D, change: R)
Adds to the weight of an element in the collection.
sourcepub fn update_at(&mut self, element: D, time: T, change: R)
pub fn update_at(&mut self, element: D, time: T, change: R)
Adds to the weight of an element in the collection at a future time.
sourcepub fn flush(&mut self)
pub fn flush(&mut self)
Forces buffered data into the timely dataflow input, and advances its time to match that of the session.
It is important to call flush
before expecting timely dataflow to report progress. Until this method is
called, all updates may still be in internal buffers and not exposed to timely dataflow. Once the method is
called, all buffers are flushed and timely dataflow is advised that some logical times are no longer possible.
sourcepub fn advance_to(&mut self, time: T)
pub fn advance_to(&mut self, time: T)
Advances the logical time for future records.
Importantly, this method does not immediately inform timely dataflow of the change. This happens only when
the session is dropped or flushed. It is not correct to use this time as a basis for a computation’s step_while
method unless the session has just been flushed.
Trait Implementations§
Auto Trait Implementations§
impl<T, D, R> Freeze for InputSession<T, D, R>where
T: Freeze,
impl<T, D, R> !RefUnwindSafe for InputSession<T, D, R>
impl<T, D, R> !Send for InputSession<T, D, R>
impl<T, D, R> !Sync for InputSession<T, D, R>
impl<T, D, R> Unpin for InputSession<T, D, R>
impl<T, D, R> !UnwindSafe for InputSession<T, D, R>
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<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.