Class: Dynflow::Coordinator::ExecutionLock

Inherits:
LockByWorld show all
Defined in:
lib/dynflow/coordinator.rb

Constant Summary

Constants inherited from Serializable

Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT

Instance Attribute Summary

Attributes inherited from Record

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LockByWorld

inherited, unique_filter, valid_classes, valid_owner_ids, #validate!, #world_id

Methods inherited from Lock

constantize, #owner_id, #to_s, #validate!

Methods inherited from Record

#==, constantize, #from_hash, #hash, #id, new_from_hash, #to_hash, #to_s, #validate!

Methods inherited from Serializable

constantize, from_hash, new_from_hash, #to_hash

Constructor Details

#initialize(world, execution_plan_id, client_world_id, request_id) ⇒ ExecutionLock

Returns a new instance of ExecutionLock.



283
284
285
286
287
288
289
# File 'lib/dynflow/coordinator.rb', line 283

def initialize(world, execution_plan_id, client_world_id, request_id)
  super(world)
  @data.merge!(id: self.class.lock_id(execution_plan_id),
               execution_plan_id: execution_plan_id,
               client_world_id: client_world_id,
               request_id: request_id)
end

Class Method Details

.lock_id(execution_plan_id) ⇒ Object



291
292
293
# File 'lib/dynflow/coordinator.rb', line 291

def self.lock_id(execution_plan_id)
  "execution-plan:#{execution_plan_id}"
end

Instance Method Details

#client_world_idObject



302
303
304
# File 'lib/dynflow/coordinator.rb', line 302

def client_world_id
  @data[:client_world_id]
end

#execution_plan_idObject

we need to store the following data in case of invalidation of the lock from outside (after the owner world terminated unexpectedly)



298
299
300
# File 'lib/dynflow/coordinator.rb', line 298

def execution_plan_id
  @data[:execution_plan_id]
end

#request_idObject



306
307
308
# File 'lib/dynflow/coordinator.rb', line 306

def request_id
  @data[:request_id]
end

#unlock_on_shutdown?Boolean

Returns:

  • (Boolean)


310
311
312
# File 'lib/dynflow/coordinator.rb', line 310

def unlock_on_shutdown?
  false
end