Class: Bosh::Director::EventLog::Task
- Defined in:
- lib/bosh/director/event_log.rb
Instance Method Summary collapse
- #advance(delta, data = {}) ⇒ Object
- #failed(error_msg = nil) ⇒ Object
- #finish ⇒ Object
-
#initialize(stage, name, index) ⇒ Task
constructor
A new instance of Task.
- #start ⇒ Object
Constructor Details
#initialize(stage, name, index) ⇒ Task
Returns a new instance of Task.
102 103 104 105 106 107 108 |
# File 'lib/bosh/director/event_log.rb', line 102 def initialize(stage, name, index) @stage = stage @name = name @index = index @state = 'in_progress' @progress = 0 end |
Instance Method Details
#advance(delta, data = {}) ⇒ Object
110 111 112 113 114 |
# File 'lib/bosh/director/event_log.rb', line 110 def advance(delta, data = {}) @state = 'in_progress' @progress = [@progress + delta, 100].min log_entry(data) end |
#failed(error_msg = nil) ⇒ Object
127 128 129 130 131 |
# File 'lib/bosh/director/event_log.rb', line 127 def failed(error_msg = nil) @state = 'failed' @progress = 100 log_entry("error" => error_msg) end |
#finish ⇒ Object
121 122 123 124 125 |
# File 'lib/bosh/director/event_log.rb', line 121 def finish @state = 'finished' @progress = 100 log_entry end |
#start ⇒ Object
116 117 118 119 |
# File 'lib/bosh/director/event_log.rb', line 116 def start @state = 'started' log_entry end |