Class: God::Task

Class | God::Task
In: | lib/god/task.rb
Parent: | Object

### Methods

action attach autostart? canonical_hash_form dest_desc detach handle_event handle_poll lifecycle log_line method_missing monitor move new notify prepare register! transition trigger trigger? unmonitor unregister! valid?

### Attributes

autostart | [W] |
behaviors | [RW] | api
directory | [RW] | api
driver | [RW] |
group | [RW] |
initial_state | [RW] |
interval | [RW] |
metrics | [RW] | api
name | [RW] |
state | [RW] | api
valid_states | [RW] |

### Public Class methods

new()

### Public Instance methods

action(a, c = nil)

Perform the given action

      +a+ is the action Symbol
      +c+ is the Condition

Returns Task (self)

attach(condition)

Events

autostart?()
canonical_hash_form(to)

Advanced mode

dest_desc(metric, condition)

Format the destination specification for use in debug logging

      +metric+ is the Metric
      +condition+ is the Condition

Returns String

detach(condition)
handle_event(condition)

Asynchronously evaluate and handle the given event condition. Handles logging notifications, and moving to the new state if necessary

      +condition+ is the Condition to handle

Returns nothing

handle_poll(condition)

Evaluate and handle the given poll condition. Handles logging notifications, and moving to the new state if necessary

      +condition+ is the Condition to handle

Returns nothing

lifecycle() {|m| ...}
log_line(watch, metric, condition, result)

Log info about the condition and return the list of messages logged

      +watch+ is the Watch
      +metric+ is the Metric
      +condition+ is the Condition
      +result+ is the Boolean result of the condition test evaluation

Returns String[]

method_missing(sym, *args)

Actions

monitor()

Enable monitoring

Returns nothing

move(to_state)

Move to the givent state

      +to_state+ is the Symbol representing the state to move to

Returns Task (self)

notify(condition, message)

Notify all recipeients of the given condition with the specified message

      +condition+ is the Condition
      +message+ is the String message to send

Returns nothing

prepare()
register!()

Registration

transition(start_states, end_states) {|m| ...}

Define a transition handler which consists of a set of conditions

trigger(condition)

Notify the Driver that an EventCondition has triggered

Returns nothing

trigger?(metric, result)

Determine whether a trigger happened

      +metric+ is the Metric
      +result+ is the result from the condition's test

Returns Boolean

unmonitor()

Disable monitoring

Returns nothing

unregister!()
valid?()

[Validate]