Sha256: 21a3b67124f82e62c18c62a3a4fa0d059360051115b39e609c8c62f3628815a1

Contents?: true

Size: 608 Bytes

Versions: 53

Compression:

Stored size: 608 Bytes

Contents

class KuberKit::Actions::ActionResult
  attr_reader :finished_tasks, :all_results, :error

  def initialize()
    @all_results     = {}
    @started_tasks   = []
    @finished_tasks  = []
    @mutex = Mutex.new
  end

  def start_task(task)
    @mutex.synchronize do
      @started_tasks.push(task)
    end
  end

  def finish_task(task, result = nil)
    @mutex.synchronize do
      @started_tasks.delete(task)
      @finished_tasks.push(task)
      @all_results[task] = result
    end
  end

  def failed!(error)
    @error = error
  end

  def succeeded?
    @error.nil? && @started_tasks.empty?
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
kuber_kit-0.8.4 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.8.3 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.8.2 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.8.1 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.8.0 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.7.1 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.7.0 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.6.4 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.6.3 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.6.2 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.6.1 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.6.0 lib/kuber_kit/actions/action_result.rb
kuber_kit-0.5.10 lib/kuber_kit/actions/action_result.rb