Add state machine diagram to docs

Use graphviz plugin to sphinx to add a state transition diagram.
This commit is contained in:
Doug Hellmann 2014-03-17 15:30:37 -04:00
parent 89d82dfa7c
commit 2a9dd047be
4 changed files with 65 additions and 1 deletions

View File

@ -25,7 +25,7 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.graphviz']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

View File

@ -11,6 +11,7 @@ Contents:
.. toctree::
:maxdepth: 2
state_machine
Indices and tables
==================

View File

@ -0,0 +1,30 @@
digraph rug {
rankdir=LR;
node [shape = doublecircle]; EXIT;
node [shape = circle];
START -> CALC_ACTION [ label = "vm>D,ACT>P" ];
CALC_ACTION -> ALIVE [ label = "ACT>[CRUP],vm:[UC]" ];
CALC_ACTION -> EXIT [ label = "ACT>D,vm:D" ];
CALC_ACTION -> STOP [ label = "ACT>D" ];
CALC_ACTION -> CREATE [ label = "ACT>[CRUP],vm:D" ];
ALIVE -> CREATE [ label = "ACT:[CRU],vm>D" ];
ALIVE -> CONFIG [ label = "ACT:[CU],vm:[UC]" ];
ALIVE -> STATS [ label = "ACT:R,vm:C" ];
ALIVE -> CALC_ACTION [ label = "ACT:P,vm>[UC]" ];
CREATE -> CALC_ACTION [ label = "vm:D" ];
CREATE -> CONFIG [ label = "vm>U" ];
CONFIG -> STOP [ label = "vm>R" ];
CONFIG -> STATS [ label = "ACT:R,vm>C" ];
CONFIG -> CALC_ACTION [ label = "ACT>P,vm>C" ];
STATS -> CALC_ACTION [ label = "ACT>P" ];
STOP -> EXIT [ label = "ACT:D,vm>D" ];
STOP -> CREATE [ label = "vm>D" ];
}

View File

@ -0,0 +1,33 @@
======================
Worker State Machine
======================
.. graphviz:: state_machine.dot
States
======
:CALC_ACTION: Coalesces the pending actions from the queue inside the state machine.
:ALIVE: Checks whether the instance is alive.
:STATS: Reads traffic data from the router.
:CREATE: Makes a new VM instance.
:CONFIG: Configures the VM and its services.
:STOP: Terminates a running VM.
:EXIT: Processing stops.
ACT(ion) Variable
=================
:Create: Create router was requested.
:Read: Read router traffic stats.
:Update: Update router configuration.
:Delete: Delete router.
:Poll: Poll router alive status.
vm Variable
===========
:Down: VM is known to be down.
:Up: VM is known to be up (pingable).
:Configured: VM is known to be configured.
:Restart Needed: VM needs to be rebooted.