Skip to content

stcore language defintion

Mike Dewar edited this page Nov 14, 2015 · 30 revisions

This describes stcore's concepts and values.

Blocks, Connections, and Messages

stcore consists of blocks and connections. stcore works by passing messages between blocks along connections. A message can be anything that is valid JSON:

  • numbers: 4.2
  • strings: foo
  • booleans: true
  • arrays: ['a','b','c']
  • objects: {"hello":"world", "weight":6.4}

or it can be an error message.

A block performs a single operation on its inbound messages. This might be something as simple as a sum, or something more complex like performing an HTTP GET request.

A block has a set of inbound routes and a set of outbound routes. Data flows from outbound routes and to inbound routes.

Sources

Any persistent state, or connection to services in the outside world, is represented as a source. st-core treats sources separately from the rest of the blocks, as they don't follow the typical block rules as outlined below. Instead, sources have dedicated blocks that provide access - so a keyValue source has a get block, and a stream source has a receive block and so on.

Block Rules

Each block operates on the messages it receives following a set of simple rules:

  • a block does not accept new messages until it has processed its current messages.
  • a block does not operate until all its inbound routes are satisfied.
  • any store or interface linked to a block is locked until that block has finished processing.

Grouping

stcore allows for groups of blocks to be collected together and labelled. Unlike composition, this has no effect on the operation of the collection of blocks, but does allow for labelling, re-use, and sharing of useful patterns.

The grouping mechanism in stcore maintains a tree structure. All elements of a pattern live either in the top-level root group or in a lower level group. This means that the grouping mechanism can also be used by front-end clients to implement user sessions, or a Matryoshka-doll like inspection of system elements.

Grouping also allows the user to control the classic "hairball" problem typically associated with visual languages, as components can be neatly packed into groups and explored separately.

Clone this wiki locally