Commit Graph

7 Commits

Author SHA1 Message Date
Mitchell Hashimoto 8a9e1c1527
dag: call into DotNode to get attributes 2016-12-03 15:17:14 -08:00
James Bardin 6d30b60144 Add DebugVisitInfo
This encodes vertex debug information into the graph log when a vertex
is visited during a walk operation. These can ordered to show how the
Graph was walked.

Add a mutex to the encoder so it can be used during a parallel walk.

Moved string literal constants used for marshaling to pre-defined constants.
Did some renaming to make the marshal* structures more consistent.
2016-11-15 10:39:08 -05:00
James Bardin 1be8e8c5a0 Add Graph.DebugOperation test 2016-11-14 14:36:06 -05:00
James Bardin 7e66df3290 Rename annotation methods
Change AnnotateVertex and AnnotateEdge to VertexDebugInfo EdgeDebugInfo
to avoid confusion between debug output and future graph annotations.
2016-11-14 11:06:52 -05:00
James Bardin f37b2fafed Remove sync.Once from dag.Graph
dag.Graph is used as a value, but contains a sync data structure. This
prevents copying the value, and is needed if one wants to upgrade a Graph
to an AcyclicGraph.

The sync.Once only guards the init() method, which can be guarded
internally with nil checks on the fields. The init method could be
removed entirely with a proper constructor later on of we so choose.
2016-11-14 08:52:18 -05:00
James Bardin 7bbd6bfbd7 Add methods to annotate Graph vertices and edges
The AnnotateVertex and AnnotateEdge Graph methods will allow terraform
to insert arbitray information into the encoded graph stream for later
processing.
2016-11-14 08:52:18 -05:00
James Bardin 82b1a2abc2 Add graph transformation recording
The external api provided here is simply
dag.Graph.SetDebugWriter(io.Writer). When a writer is provided to a
Graph, it will immediately encode itself to the stream, and subsequently
encode any additional transformations to the graph. This will allow
easier logging of graph transformations without writing complete graphs
to the logs at every step. Since the marshalGraph can also be dot
encoded, this will allow translation from the JSON logs to dot graphs.
2016-11-14 08:50:34 -05:00