Special Nodes

The dataflow circuitry from perform the outlets of the circuit are interesting as they contain some typical plumbing:

020

Every node in this screenshot is a special node. Special nodes are the glue of Coreograph. You can find the special nodes of Coreograph documented in Special Nodes. From left to right, the special node types here are circuit (call), unpack, expr, echo, and outlet (two of them).

The unpack node takes a tuple (think of it as a JSON object for now), which may be nested, i.e., may have properties whose values are in turn other tuples. unpack flattens it so that the properties of the tuple and tuples inside are all presented as output ports of the unpack node. The particular property we are interested in from the result of perform is hdr.status.code, the familiar integer status code of HTTP responses. You have probably encountered status 200 (OK) or 404 (Not found) at some point in a browser.

The isOK() node is an expr node – a node that evaluates an expression – in this case to test whether the status code indicates success. If you double click on the expr node you can see the expression inside it:

021

The variable _0 is the first input to the expr node. This expression tests whether the status code lies in the range 0 … 399.

The echo node is a swiss army knife of synchronization and routing. It reads a value from every input port that is connected (in this case, the boolean indicating success or failure), and writes a value to every output port that is connected. In this case, the success / failure boolean is written to the top output port, and an empty string is written to the second output port. When an input is not connected, the default value for its type is sent to the corresponding output port.