[−][src]Crate actyxos_data_flow
Live data export tool for ActyxOS
ActyxOS is a decentralized event sourcing system for the factory shop-floor. One of the purposes of deploying apps in factories is to gain business insights by reporting and visualizing what is going on on the shop-floor.
With this library it is straight-forward to export event data into SQL databases with code like the following:
pub fn dashboard_logic<'a>( scope: &mut Scope<'a>, ) -> ( Input<Event<MachineEvent>>, Flow<'a, DashboardEntry, Stateful>, ) { let (injector, events) = Flow::<Event<MachineEvent>, _>::new(scope); let out = events .filter(|ev| ev.stream.name.as_str().starts_with("Drill")) .map(|ev| match ev.payload { MachineEvent::Started { order } => { DashboardEntry::working(ev.stream.name.to_string(), order, ev.timestamp) } MachineEvent::Stopped { .. } => { DashboardEntry::idle(ev.stream.name.to_string(), ev.timestamp) } }) .group_by(|entry| entry.machine.clone()) .max_by(|entry| entry.since) .ungroup(); (injector, out) }
The full project is in the example
folder, the sample webapp that generates the
underlying events can be found in the webapp
folder. Both can be deployed to
an ActyxOS node or run in developer mode, see the quickstart guide.
See also the blog post for more background information.
Modules
coll | Utility for consolidating differential dataflow deltas |
db | Tools for writing collection deltas and event offsets into SQL databases |
flow | Opinionated simplification of the differential-dataflow API |
machine | A wrapper for dataflow logic that knows how to feed inputs and get out deltas |
runner | Utility functions to tying the pieces together in a runnable fashion |