[−][src]Module actyxos_data_flow::flow
Opinionated simplification of the differential-dataflow API
Differential Dataflow provides great flexibility in terms of time tracking, multiplicity tracking, etc. This comes at the cost of many type parameters and lower quality type inference and tab completions, in particular in IDEs. This module fixes most of the type parameters, leaving open only the type of data in a collection. It also contrains the signature of the user-provided closures to reject unsuitable data (for example non-static references) at their place of introduction instead of presenting the error when trying to transform the resultant collection.
The general shape of a differential dataflow remains the same:
use actyxos_data_flow::flow::{Scope, Flow, Input, Stateless}; fn mk_logic<'a>(scope: &mut Scope<'a>) -> (Input<String>, Flow<'a, usize, Stateless>) { let (input, flow) = Flow::new(scope); let out = flow.map(|s: String| s.len()); (input, out) }
Note how the returned flow tracks the information of whether stateful combinators are
used. There is a .map_mut()
method that allows a
stateful closure to be passed in, which will make the example not compile unless also
switching the declared output type to Stateful
.
Structs
Flow | Differential dataflow |
Grouped | An arrangement of a collection by key |
Input | An input to a Flow |
Output | An output of a dataflow graph |
Probe | A probe measuring the propagation of progress within the dataflow |
Stateful | Marker for stateful flows that need to see previous inputs again after restart |
Stateless | Marker for stateless flows that do not need to be warmed up with previous inputs |
Traits
NeedsState | Marker trait that tracks whether a Flow needs to keep state. |
Type Definitions
Scope | Top-level scope type where flows usually are created in. |