Struct differential_dataflow::operators::arrange::TraceAgent
source · pub struct TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,{ /* private fields */ }Expand description
A TraceReader wrapper which can be imported into other dataflows.
The TraceAgent is the default trace type produced by arranged, and it can be extracted
from the dataflow in which it was defined, and imported into other dataflows.
Implementations
sourceimpl<K, V, T, R, Tr> TraceAgent<K, V, T, R, Tr>where
T: Timestamp + Lattice,
Tr: TraceReader<K, V, T, R>,
impl<K, V, T, R, Tr> TraceAgent<K, V, T, R, Tr>where
T: Timestamp + Lattice,
Tr: TraceReader<K, V, T, R>,
sourcepub fn new(trace: Tr) -> (Self, TraceWriter<K, V, T, R, Tr>)where
Tr: Trace<K, V, T, R>,
Tr::Batch: Batch<K, V, T, R>,
pub fn new(trace: Tr) -> (Self, TraceWriter<K, V, T, R, Tr>)where
Tr: Trace<K, V, T, R>,
Tr::Batch: Batch<K, V, T, R>,
Creates a new agent from a trace reader.
sourcepub fn new_listener(
&mut self
) -> Rc<RefCell<VecDeque<(Vec<T>, Option<(T, <Tr as TraceReader<K, V, T, R>>::Batch)>)>>>where
T: Default,
pub fn new_listener(
&mut self
) -> Rc<RefCell<VecDeque<(Vec<T>, Option<(T, <Tr as TraceReader<K, V, T, R>>::Batch)>)>>>where
T: Default,
Attaches a new shared queue to the trace.
The queue will be immediately populated with existing historical batches from the trace, and until the reference
is dropped the queue will receive new batches as produced by the source arrange operator.
sourceimpl<K, V, T, R, Tr> TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
impl<K, V, T, R, Tr> TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
sourcepub fn import<G: Scope<Timestamp = T>>(
&mut self,
scope: &G
) -> Arranged<G, K, V, R, TraceAgent<K, V, T, R, Tr>>where
T: Timestamp,
pub fn import<G: Scope<Timestamp = T>>(
&mut self,
scope: &G
) -> Arranged<G, K, V, R, TraceAgent<K, V, T, R, Tr>>where
T: Timestamp,
Copies an existing collection into the supplied scope.
This method creates an Arranged collection that should appear indistinguishable from applying arrange
directly to the source collection brought into the local scope. The only caveat is that the initial state
of the collection is its current state, and updates occur from this point forward. The historical changes
the collection experienced in the past are accumulated, and the distinctions from the initial collection
are no longer evident.
The current behavior is that the introduced collection accumulates updates to some times less or equal
to self.advance_frontier(). There is not currently a guarantee that the updates are accumulated to
the frontier, and the resulting collection history may be weirdly partial until this point. In particular,
the historical collection may move through configurations that did not actually occur, even if eventually
arriving at the correct collection. This is probably a bug; although we get to the right place in the end,
the intermediate computation could do something that the original computation did not, like diverge.
I would expect the semantics to improve to “updates are advanced to self.advance_frontier()”, which
means the computation will run as if starting from exactly this frontier. It is not currently clear whose
responsibility this should be (the trace/batch should only reveal these times, or an operator should know
to advance times before using them).
Examples
extern crate timely;
extern crate differential_dataflow;
use timely::Configuration;
use differential_dataflow::input::Input;
use differential_dataflow::operators::arrange::ArrangeBySelf;
use differential_dataflow::operators::group::Group;
use differential_dataflow::trace::Trace;
use differential_dataflow::trace::implementations::ord::OrdValSpine;
use differential_dataflow::hashable::OrdWrapper;
fn main() {
::timely::execute(Configuration::Thread, |worker| {
// create a first dataflow
let mut trace = worker.dataflow::<u32,_,_>(|scope| {
// create input handle and collection.
scope.new_collection_from(0 .. 10).1
.arrange_by_self()
.trace
});
// do some work.
worker.step();
worker.step();
// create a second dataflow
worker.dataflow(move |scope| {
trace.import(scope)
.group(move |_key, src, dst| dst.push((*src[0].0, 1)));
});
}).unwrap();
}Trait Implementations
sourceimpl<K, V, T, R, Tr> Clone for TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
impl<K, V, T, R, Tr> Clone for TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
sourceimpl<K, V, T, R, Tr> Drop for TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
impl<K, V, T, R, Tr> Drop for TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
sourceimpl<K, V, T, R, Tr> TraceReader<K, V, T, R> for TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
impl<K, V, T, R, Tr> TraceReader<K, V, T, R> for TraceAgent<K, V, T, R, Tr>where
T: Lattice + Ord + Clone + 'static,
Tr: TraceReader<K, V, T, R>,
type Batch = <Tr as TraceReader<K, V, T, R>>::Batch
type Batch = <Tr as TraceReader<K, V, T, R>>::Batch
type Cursor = <Tr as TraceReader<K, V, T, R>>::Cursor
type Cursor = <Tr as TraceReader<K, V, T, R>>::Cursor
sourcefn advance_by(&mut self, frontier: &[T])
fn advance_by(&mut self, frontier: &[T])
sourcefn advance_frontier(&mut self) -> &[T] ⓘ
fn advance_frontier(&mut self) -> &[T] ⓘ
sourcefn distinguish_since(&mut self, frontier: &[T])
fn distinguish_since(&mut self, frontier: &[T])
cursor_through. Read moresourcefn distinguish_frontier(&mut self) -> &[T] ⓘ
fn distinguish_frontier(&mut self) -> &[T] ⓘ
sourcefn cursor_through(
&mut self,
frontier: &[T]
) -> Option<(Tr::Cursor, <Tr::Cursor as Cursor<K, V, T, R>>::Storage)>
fn cursor_through(
&mut self,
frontier: &[T]
) -> Option<(Tr::Cursor, <Tr::Cursor as Cursor<K, V, T, R>>::Storage)>
upper. Read more