+ STATES = [
+ 'initial',
+ 'configuring',
+ 'configured',
+ 'loading',
+ 'failed',
+ {
+ 'name': 'loaded',
+ 'children': [
+ 'no_config',
+ 'no_actions',
+ 'running',
+ 'protecting_repeat'
+ ]
+ }
+ ]
+
+ TRANSITIONS = [
+ {
+ 'trigger': 'configure',
+ 'source': 'initial',
+ 'dest': 'configuring'
+ },
+ {
+ 'trigger': 'fail',
+ 'source': 'configuring',
+ 'dest': 'failed',
+ 'after': 'key_loaded_callback'
+ },
+ {
+ 'trigger': 'success',
+ 'source': 'configuring',
+ 'dest': 'configured',
+ 'after': 'load'
+ },
+ {
+ 'trigger': 'no_config',
+ 'source': 'configuring',
+ 'dest': 'loaded_no_config',
+ 'after': 'key_loaded_callback'
+ },
+ {
+ 'trigger': 'load',
+ 'source': 'configured',
+ 'dest': 'loading'
+ },
+ {
+ 'trigger': 'fail',
+ 'source': 'loading',
+ 'dest': 'failed',
+ 'after': 'key_loaded_callback'
+ },
+ {
+ 'trigger': 'success',
+ 'source': 'loading',
+ 'dest': 'loaded',
+ 'after': 'key_loaded_callback'
+ },
+ {
+ 'trigger': 'no_actions',
+ 'source': 'loading',
+ 'dest': 'loaded_no_actions',
+ 'after': 'key_loaded_callback'
+ },
+ {
+ 'trigger': 'reload',
+ 'source': ['loaded','failed'],
+ 'dest': 'configuring',
+ 'after': 'key_loaded_callback'
+ },
+ {
+ 'trigger': 'run',
+ 'source': 'loaded',
+ 'dest': 'loaded_running',
+ 'after': ['run_actions', 'finish'],
+ # if a child, like loaded_no_actions, has no transitions, then it
+ # is bubbled to the parent, and we don't want that.
+ 'conditions': ['is_loaded']
+ },
+ {
+ 'trigger': 'finish',
+ 'source': 'loaded_running',
+ 'dest': 'loaded_protecting_repeat'
+ },
+ {
+ 'trigger': 'repeat_protection_finished',
+ 'source': 'loaded_protecting_repeat',
+ 'dest': 'loaded'
+ },
+ ]
+