Class: Bosh::Director::EventLog::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/event_log.rb

Instance Method Summary collapse

Constructor Details

#initialize(stage, name, index) ⇒ Task

Returns a new instance of Task.



116
117
118
119
120
121
122
# File 'lib/bosh/director/event_log.rb', line 116

def initialize(stage, name, index)
  @stage = stage
  @name = name
  @index = index
  @state = 'in_progress'
  @progress = 0
end

Instance Method Details

#advance(delta, data = {}) ⇒ Object



124
125
126
127
128
# File 'lib/bosh/director/event_log.rb', line 124

def advance(delta, data = {})
  @state = 'in_progress'
  @progress = [@progress + delta, 100].min
  log_entry(data)
end

#failed(error_msg = nil) ⇒ Object



141
142
143
144
145
# File 'lib/bosh/director/event_log.rb', line 141

def failed(error_msg = nil)
  @state = 'failed'
  @progress = 100
  log_entry("error" => error_msg)
end

#finishObject



135
136
137
138
139
# File 'lib/bosh/director/event_log.rb', line 135

def finish
  @state = 'finished'
  @progress = 100
  log_entry
end

#startObject



130
131
132
133
# File 'lib/bosh/director/event_log.rb', line 130

def start
  @state = 'started'
  log_entry
end