Class: Kitsune::Kit::Workflows::ApplyPlan

Inherits:
Base
  • Object
show all
Defined in:
lib/kitsune/kit/workflows/apply_plan.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:, operations:, state_store: nil, cancellation: Cancellation.new, event_bus: Events::NullBus.new, clock: Clock.new) ⇒ ApplyPlan

Returns a new instance of ApplyPlan.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kitsune/kit/workflows/apply_plan.rb', line 12

def initialize(config:, operations:, state_store: nil, cancellation: Cancellation.new,
               event_bus: Events::NullBus.new, clock: Clock.new)
  super(config: config, event_bus: event_bus, clock: clock)
  @operations = operations
  @cancellation = cancellation
  @state_store = state_store
  @journal = RunJournal.new(
    state_store: state_store,
    environment: config.environment,
    run_id: run_id,
    clock: -> { clock.now }
  )
end

Instance Method Details

#call(plan: nil, resume_from: nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/kitsune/kit/workflows/apply_plan.rb', line 26

def call(plan: nil, resume_from: nil)
  return call_unlocked(plan: plan, resume_from: resume_from) unless @state_store

  @state_store.with_execution_lock(config.environment) do
    call_unlocked(plan: plan, resume_from: resume_from)
  end
end