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.



270
271
272
273
274
275
276
# File 'lib/dynflow/coordinator.rb', line 270

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



278
279
280
# File 'lib/dynflow/coordinator.rb', line 278

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

Instance Method Details

#client_world_idObject



289
290
291
# File 'lib/dynflow/coordinator.rb', line 289

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)



285
286
287
# File 'lib/dynflow/coordinator.rb', line 285

def execution_plan_id
  @data[:execution_plan_id]
end

#request_idObject



293
294
295
# File 'lib/dynflow/coordinator.rb', line 293

def request_id
  @data[:request_id]
end