| 27 | |
| 28 | impl Run for Vec<Case<u64>> { |
| 29 | fn run(mut self) { |
| 30 | for mut case in self.drain(..) { |
| 31 | timely::execute_directly(move |worker| { |
| 32 | let mut server = Server::<u64, u64>::new(Default::default()); |
| 33 | let (send_results, results) = channel(); |
| 34 | |
| 35 | dbg!(case.description); |
| 36 | |
| 37 | let mut deps = HashMap::new(); |
| 38 | for tx in case.transactions.iter() { |
| 39 | for datum in tx { |
| 40 | deps.entry(datum.2.clone()).or_insert_with(|| { |
| 41 | AttributeConfig::tx_time(InputSemantics::CardinalityOne) |
| 42 | }); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | let plan = case.plan; |
| 47 | |
| 48 | worker.dataflow::<u64, _, _>(|scope| { |
| 49 | for (dep, config) in deps.drain() { |
| 50 | server |
| 51 | .context |
| 52 | .internal |
| 53 | .create_transactable_attribute(&dep, config, scope) |
| 54 | .unwrap(); |
| 55 | } |
| 56 | |
| 57 | server |
| 58 | .test_single( |
| 59 | scope, |
| 60 | Rule { |
| 61 | name: "query".to_string(), |
| 62 | plan, |
| 63 | }, |
| 64 | ) |
| 65 | .inner |
| 66 | .sink(Pipeline, "Results", move |input| { |
| 67 | input.for_each(|_time, data| { |
| 68 | for datum in data.iter() { |
| 69 | send_results.send(datum.clone()).unwrap() |
| 70 | } |
| 71 | }); |
| 72 | }); |
| 73 | }); |
| 74 | |
| 75 | let mut next_tx = 0; |
| 76 | |
| 77 | // Make sure we can pop off transactions one-by-one. |
| 78 | case.transactions.reverse(); |
| 79 | |
| 80 | for mut expected_tuples in case.expectations.drain(..) { |
| 81 | next_tx += 1; |
| 82 | |
| 83 | if let Some(tx_data) = case.transactions.pop() { |
| 84 | server.transact(tx_data, 0, 0).unwrap(); |
| 85 | } |
| 86 | |