Class: Dynflow::Coordinator::LockByWorld
- Inherits:
-
Lock
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 Lock
constantize, #owner_id, #to_s, #unlock_on_shutdown?
Methods inherited from Record
#==, constantize, #from_hash, #hash, #id, new_from_hash, #to_hash, #to_s
constantize, from_hash, new_from_hash, #to_hash
Constructor Details
Returns a new instance of LockByWorld.
155
156
157
158
159
|
# File 'lib/dynflow/coordinator.rb', line 155
def initialize(world)
super
@world = world
@data.merge!(owner_id: "world:#{world.id}", world_id: world.id)
end
|
Class Method Details
.inherited(klass) ⇒ Object
186
187
188
|
# File 'lib/dynflow/coordinator.rb', line 186
def self.inherited(klass)
valid_classes << klass
end
|
.lock_id(*args) ⇒ Object
161
162
163
|
# File 'lib/dynflow/coordinator.rb', line 161
def self.lock_id(*args)
raise NoMethodError
end
|
.unique_filter(*args) ⇒ Object
165
166
167
|
# File 'lib/dynflow/coordinator.rb', line 165
def self.unique_filter(*args)
{ :class => self.name, :id => lock_id(*args) }
end
|
.valid_classes ⇒ Object
182
183
184
|
# File 'lib/dynflow/coordinator.rb', line 182
def self.valid_classes
@valid_classes ||= []
end
|
.valid_owner_ids(coordinator) ⇒ Object
178
179
180
|
# File 'lib/dynflow/coordinator.rb', line 178
def self.valid_owner_ids(coordinator)
coordinator.find_worlds.map { |w| "world:#{w.id}" }
end
|
Instance Method Details
#validate! ⇒ Object
169
170
171
172
|
# File 'lib/dynflow/coordinator.rb', line 169
def validate!
super
raise Errors::InactiveWorldError.new(@world) if @world.terminating?
end
|
#world_id ⇒ Object
174
175
176
|
# File 'lib/dynflow/coordinator.rb', line 174
def world_id
@data[:world_id]
end
|