Lift Packets for Processing in NoFlo
npm install noflo-lift
|23||downloads in the last month|
|Version||0.0.12 last updated 6 months ago|
|Keywords||noflo, lift, extract, subset|
|Dependencies (10)||noflo, underscore, underscore.string, noflo-swiss, noflo-flow, noflo-groups, noflo-packets, noflo-test, nohoarder, noflo-cache|
In a NoFlo program, how the program processes data is more important than the data structure. It is evident in that most NoFlo programs expect a rather flat data structure of a series of packets enclosed in one or two levels of groups.
When your program expects a more complex data structure, it is useful to be able to extract a subset of the structure, do some work, and plug it right back into where it was extracted from. noflo-lift allows you to literally "lift" a subset of the data structure by providing a pattern object for further processing on just that one piece. It then accepts some data structure that noflo-lift would then insert back in place.
noflo-lift accepts data via these ports:
Any valid NoFlo data structure
A pattern is a path-like array denoting the group structure to extract. For instance, in XML schematics, if you have an incoming data structure:
<GroupA> <GroupB> <GroupC> <Data1/> <Data2/> </GroupC> <Data3/> <Data4/> </GroupB> <GroupD> <Data5/> <Data6/> </GroupD> </GroupA>
And you want to extract just
GroupC for processing, you would pass in,
[ "GroupA", "GroupB", "GroupC" ]
The processed data structure must be returned to this port to continue
its journal through the
OUT port. See the
PROCESS out port for
Standing for REturnTOKEN, this port accepts a token to be used to retrieve what was stored in order for the returned object to replace it.
noflo-lift does not have a cache limit as it expects you to finish processing on all opened requests. You may optionally set a cache size if you deal with asynchronous operations that may fail.
noflo-lift emits data via these ports:
The data structure that has been processed and plugged back in is emitted to this port.
The extracted data structure is emitted here. It is grouped at the
top-level by a token, which must group the processed data structure on
return to the
RETURN in port.
Standing for EXtractedTOKEN, this port emits the token when a sub-structure is extracted so Lift can identify which structure to replace when a new sub-structure is returned.