com.walmartlabs.datascope

Composite

protocol

A non-scalar type, which wraps one or more values (e.g., map, sequence, vector, reference, etc.)

members

composite-type

(composite-type v)

Returns :map, :seq, :vec, etc. This key is used when generating Graphviz node ids.

render-as-scalar?

(render-as-scalar? v)

Returns true if should be rendered as a scalar. Typically, this means an empty collection.

render-composite

(render-composite v state)

Renders the value as a new node (this is often quite recursive).

Returns a tuple of the new state, and the node-id just rendered.

State has a number of keys:

:values
map from a non-scalar value to its unique node id; this is used to create edges, and track which values have already been rendered. The key is the default hash code for the value (e.g., keyed on identity, not on value).
:nodes
map from node id to the text to render for that node (outer brackets are supplied).
:edges
map from node id to node id; the source node is may be extended with a port (e.g., “map_1:v3”)"

dot

(dot root-value)

Given a root composite value, returns the DOT (Graphviz description) of the composite value.

Scalar

protocol

Scalars appear as keys and values and this protocol assists with rendering of them as such.

members

as-label

(as-label v)

Return the text representation of a value such that it can be included as a label for a key or value.

The returned value should be HTML safe.

view

(view root-value)

Renders the root value as a Graphviz document, then uses Rhizome to open a frame to view the document.