generalize dataflow_using
@@ -213,30 +213,27 @@ impl<A: Allocate> Worker<A> {
T: Refines<()>,
F: FnOnce(&mut Child<Self, T>)->R,
{
- self.dataflow_using(Box::new(()), |_, child| func(child))
+ let logging = self.logging.borrow_mut().get("timely");
+ self.dataflow_core("Dataflow", logging, Box::new(()), |_, child| func(child))
}
- /// Construct a new dataflow binding resources that are released only after the dataflow is dropped.
+ /// Construct a new dataflow with specific configurations.
///
- /// This method is designed to allow the dataflow builder to use certain resources that are then stashed
- /// with the dataflow until it has completed running. Once complete, the resources are dropped. The most
- /// common use of this method at present is with loading shared libraries, where the library is important
- /// for building the dataflow, and must be kept around until after the dataflow has completed operation.
- pub fn dataflow_using<T, R, F, V>(&mut self, mut resources: V, func: F) -> R
+ /// This method constructs a new dataflow, using a name, logger, and additional
+ /// resources specified as argument. The name is cosmetic, the logger is used to
+ /// handle events generated by the dataflow, and the additional resources are kept
+ /// alive for as long as the dataflow is alive (use case: shared library bindings).
+ pub fn dataflow_core<T, R, F, V>(&mut self, name: &str, mut logging: Option<TimelyLogger>, mut resources: V, func: F) -> R
where
T: Refines<()>,
F: FnOnce(&mut V, &mut Child<Self, T>)->R,
V: Any+'static,
{
-
- // let addr = vec![self.allocator.borrow().index()];
let addr = vec![];
let dataflow_index = self.allocate_dataflow_index();
let identifier = self.new_identifier();
- let mut logging = self.logging.borrow_mut().get("timely");
-
- let subscope = SubgraphBuilder::new_from(dataflow_index, addr, logging.clone(), "Dataflow");
+ let subscope = SubgraphBuilder::new_from(dataflow_index, addr, logging.clone(), name);
let subscope = RefCell::new(subscope);
let result = {
